jumpserver/terminal/utils.py

35 lines
570 B
Python
Raw Normal View History

2016-09-24 16:21:32 +00:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
2016-09-25 03:30:02 +00:00
#
import logging
2016-09-25 11:53:55 +00:00
from logging.config import dictConfig
from ssh_config import config, env
2016-09-25 03:30:02 +00:00
2016-09-24 16:21:32 +00:00
2016-09-25 11:53:55 +00:00
CONFIG_SSH_SERVER = config.get(env)
def get_logger(name):
dictConfig(CONFIG_SSH_SERVER.LOGGING)
return logging.getLogger('jumpserver.%s' % name)
2016-09-24 16:21:32 +00:00
2016-09-26 16:10:14 +00:00
class ControlChar:
CHARS = {
'clear': '\x1b[H\x1b[2J',
}
def __init__(self):
pass
def __getattr__(self, item):
return self.__class__.CHARS.get(item, '')
2016-09-25 15:11:09 +00:00
class SSHServerException(Exception):
pass
2016-09-26 16:10:14 +00:00
control_char = ControlChar()