mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
use 'OPENPYPE_LOG_LEVEL' if available instead of 'OPENPYPE_DEBUG'
This commit is contained in:
parent
43a9eeb245
commit
15d59e1f00
1 changed files with 13 additions and 8 deletions
|
|
@ -216,8 +216,8 @@ class PypeLogger:
|
|||
# Collection name under database in Mongo
|
||||
log_collection_name = "logs"
|
||||
|
||||
# OPENPYPE_DEBUG
|
||||
pype_debug = 0
|
||||
# Logging level - OPENPYPE_LOG_LEVEL
|
||||
log_level = None
|
||||
|
||||
# Data same for all record documents
|
||||
process_data = None
|
||||
|
|
@ -231,10 +231,7 @@ class PypeLogger:
|
|||
|
||||
logger = logging.getLogger(name or "__main__")
|
||||
|
||||
if cls.pype_debug > 0:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
else:
|
||||
logger.setLevel(logging.INFO)
|
||||
logger.setLevel(cls.log_level)
|
||||
|
||||
add_mongo_handler = cls.use_mongo_logging
|
||||
add_console_handler = True
|
||||
|
|
@ -357,8 +354,16 @@ class PypeLogger:
|
|||
# Store result to class definition
|
||||
cls.use_mongo_logging = use_mongo_logging
|
||||
|
||||
# Define if is in OPENPYPE_DEBUG mode
|
||||
cls.pype_debug = int(os.getenv("OPENPYPE_DEBUG") or "0")
|
||||
# Define what is logging level
|
||||
log_level = os.getenv("OPENPYPE_LOG_LEVEL")
|
||||
if not log_level:
|
||||
# Check OPENPYPE_DEBUG for backwards compatibility
|
||||
op_debug = os.getenv("OPENPYPE_DEBUG")
|
||||
if op_debug and int(op_debug) > 0:
|
||||
log_level = 10
|
||||
else:
|
||||
log_level = 20
|
||||
cls.log_level = int(log_level)
|
||||
|
||||
if not os.environ.get("OPENPYPE_MONGO"):
|
||||
cls.use_mongo_logging = False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue