Commit 96527df2 authored by ibuler's avatar ibuler

Update logger

parent 16ab83fe
...@@ -26,7 +26,7 @@ class Luna(Flask): ...@@ -26,7 +26,7 @@ class Luna(Flask):
print(time.ctime()) print(time.ctime())
print( print(
'Luna version %s, more see https://www.jumpserver.org' % __version__) 'Luna version %s, more see https://www.jumpserver.org' % __version__)
print('Starting ssh server at %(host)s:%(port)s' % print('Starting web server at %(host)s:%(port)s' %
{'host': self.config['BIND_HOST'], {'host': self.config['BIND_HOST'],
'port': self.config['LISTEN_PORT']}) 'port': self.config['LISTEN_PORT']})
print('Quit the server with CONTROL-C.') print('Quit the server with CONTROL-C.')
......
...@@ -22,12 +22,12 @@ LOG_LEVELS = { ...@@ -22,12 +22,12 @@ LOG_LEVELS = {
} }
def create_logger(app): def create_logger():
level = config.get('LOG_LEVEL', None) level = config.get('LOG_LEVEL', None)
level = LOG_LEVELS.get(level, logging.INFO) level = LOG_LEVELS.get(level, logging.INFO)
log_dir = config.get('LOG_DIR', os.path.join(PROJECT_DIR, 'logs')) log_dir = config.get('LOG_DIR', os.path.join(PROJECT_DIR, 'logs'))
log_path = os.path.join(log_dir, 'luna.log') log_path = os.path.join(log_dir, 'luna.log')
logger_root = app.logger logger_root = logging.getLogger()
logger = logging.getLogger(config.get('NAME', 'luna')) logger = logging.getLogger(config.get('NAME', 'luna'))
main_formatter = logging.Formatter( main_formatter = logging.Formatter(
...@@ -48,4 +48,4 @@ def create_logger(app): ...@@ -48,4 +48,4 @@ def create_logger(app):
def get_logger(name): def get_logger(name):
return logging.getLogger('luna.%s' % name) return logging.getLogger('luna.%s' % name)
create_logger(app) create_logger()
# ~*~ coding: utf-8 ~*~ # ~*~ coding: utf-8 ~*~
import select
import threading import threading
import collections import collections
import json import json
import logging
import paramiko
from flask import request, g from flask import request, g
from jms.utils import to_dotmap from jms.utils import to_dotmap
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment