mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-30 11:56:18 -05:00
Changing default log level back to INFO.
This commit is contained in:
parent
fd619853b6
commit
a527b0091d
4 changed files with 11 additions and 7 deletions
|
|
@ -18,4 +18,4 @@ COPY wrolpi /opt/wrolpi/wrolpi
|
|||
COPY modules /opt/wrolpi/modules
|
||||
|
||||
ENTRYPOINT [ "python3", "-OO", "/opt/wrolpi/main.py"]
|
||||
CMD ["-vv", "api", "--host", "0.0.0.0"]
|
||||
CMD ["-v", "api", "--host", "0.0.0.0"]
|
||||
|
|
|
|||
2
main.py
2
main.py
|
|
@ -17,7 +17,7 @@ from wrolpi.contexts import attach_shared_contexts, reset_shared_contexts, initi
|
|||
from wrolpi.dates import Seconds
|
||||
from wrolpi.downloader import import_downloads_config, download_manager, \
|
||||
perpetual_download_worker
|
||||
from wrolpi.vars import PROJECT_DIR, DOCKERIZED, CIRCLECI
|
||||
from wrolpi.vars import PROJECT_DIR, DOCKERIZED
|
||||
from wrolpi.version import get_version_string
|
||||
|
||||
logger = logger.getChild('wrolpi-main')
|
||||
|
|
|
|||
|
|
@ -56,14 +56,14 @@ LOGGING_CONFIG = {
|
|||
'handlers': {
|
||||
'console': {
|
||||
'class': 'logging.StreamHandler',
|
||||
'level': 'DEBUG',
|
||||
'level': 'INFO',
|
||||
'formatter': 'standard',
|
||||
'stream': 'ext://sys.stdout' # Use standard output
|
||||
}
|
||||
},
|
||||
'root': {
|
||||
'handlers': ['console'],
|
||||
'level': 'DEBUG'
|
||||
'level': 'INFO'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ def set_log_level(level, warn_level: bool = True):
|
|||
|
||||
def set_global_log_level(log_level: int):
|
||||
"""Set the global (shared between processes) log level."""
|
||||
if not isinstance(log_level, int) or 0 > log_level or log_level > 40:
|
||||
if not isinstance(log_level, int) or not 0 <= log_level <= 40:
|
||||
raise LogLevelError()
|
||||
from wrolpi.api_utils import api_app
|
||||
with api_app.shared_ctx.log_level.get_lock():
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@ import multiprocessing
|
|||
|
||||
from sanic import Sanic
|
||||
|
||||
from wrolpi.common import LOGGING_CONFIG
|
||||
|
||||
default_log_level = logging.getLevelName(LOGGING_CONFIG['root']['level'])
|
||||
|
||||
|
||||
def attach_shared_contexts(app: Sanic):
|
||||
"""Initializes Sanic's shared context with WROLPi's multiprocessing tools.
|
||||
|
|
@ -31,7 +35,7 @@ def attach_shared_contexts(app: Sanic):
|
|||
# Shared lists.
|
||||
app.shared_ctx.events_history = multiprocessing.Manager().list()
|
||||
# Shared ints
|
||||
app.shared_ctx.log_level = multiprocessing.Value(ctypes.c_int, logging.DEBUG)
|
||||
app.shared_ctx.log_level = multiprocessing.Value(ctypes.c_int, default_log_level)
|
||||
|
||||
# Download Manager
|
||||
app.shared_ctx.download_manager_data = multiprocessing.Manager().dict()
|
||||
|
|
@ -68,7 +72,7 @@ def reset_shared_contexts(app: Sanic):
|
|||
app.shared_ctx.max_disks_bandwidth.clear()
|
||||
app.shared_ctx.map_importing.clear()
|
||||
# Shared ints
|
||||
app.shared_ctx.log_level.value = logging.DEBUG
|
||||
app.shared_ctx.log_level.value = default_log_level
|
||||
|
||||
# Download Manager
|
||||
app.shared_ctx.download_manager_data.clear()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue