mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-21 21:17:23 +00:00
move logs to folder
This commit is contained in:
parent
5e59d3b43c
commit
24fc6a0826
@ -159,7 +159,7 @@ def register_blueprints(app):
|
|||||||
|
|
||||||
def register_logging(app):
|
def register_logging(app):
|
||||||
# file logger
|
# file logger
|
||||||
file_handler = RotatingFileHandler('nexus_dashboard.log', maxBytes=1024 * 1024 * 100, backupCount=20)
|
file_handler = RotatingFileHandler('logs/nexus_dashboard.log', maxBytes=1024 * 1024 * 100, backupCount=20)
|
||||||
file_handler.setLevel(logging.INFO)
|
file_handler.setLevel(logging.INFO)
|
||||||
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
||||||
file_handler.setFormatter(formatter)
|
file_handler.setFormatter(formatter)
|
||||||
|
@ -25,7 +25,7 @@ def command():
|
|||||||
@log_blueprint.route('/system')
|
@log_blueprint.route('/system')
|
||||||
@gm_level(8)
|
@gm_level(8)
|
||||||
def system():
|
def system():
|
||||||
with open('nexus_dashboard.log', 'r') as file:
|
with open('logs/nexus_dashboard.log', 'r') as file:
|
||||||
logs = '</br>'.join(file.read().split('\n')[-100:])
|
logs = '</br>'.join(file.read().split('\n')[-100:])
|
||||||
return render_template('logs/system.html.j2', logs=logs)
|
return render_template('logs/system.html.j2', logs=logs)
|
||||||
|
|
||||||
|
0
logs/.gitkeep
Normal file
0
logs/.gitkeep
Normal file
2
wsgi.py
2
wsgi.py
@ -18,7 +18,7 @@ else:
|
|||||||
from logging.handlers import RotatingFileHandler
|
from logging.handlers import RotatingFileHandler
|
||||||
gunicorn_logger = logging.getLogger('gunicorn.error')
|
gunicorn_logger = logging.getLogger('gunicorn.error')
|
||||||
app.logger.handlers = gunicorn_logger.handlers
|
app.logger.handlers = gunicorn_logger.handlers
|
||||||
file_handler = RotatingFileHandler('nexus_dashboard.log', maxBytes=1024 * 1024 * 100, backupCount=20)
|
file_handler = RotatingFileHandler('logs/nexus_dashboard.log', maxBytes=1024 * 1024 * 100, backupCount=20)
|
||||||
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
||||||
file_handler.setFormatter(formatter)
|
file_handler.setFormatter(formatter)
|
||||||
app.logger.addHandler(file_handler)
|
app.logger.addHandler(file_handler)
|
||||||
|
Loading…
Reference in New Issue
Block a user