Skip to content

Commit

Permalink
fix log bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreaFrederica committed Sep 4, 2023
1 parent e3f9ef3 commit 54fcc4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .vscode/PythonImportHelper-v2-Completion.json
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
"kind": 2,
"importPath": "module.log",
"description": "module.log",
"peekOfCode": "def init():\n if(context.config[\"Log\"]):\n log_filename = \"loguru.log\"\n log_path = \"log\"\n if(not os.path.exists):\n os.mkdir(log_path)\n log_fullpath= f\"{log_path}/{log_filename}\"\n logger.remove(0)\n logger.add(log_fullpath)\n else:",
"peekOfCode": "def init():\n logger.remove(0)\n if(context.config[\"Log\"]):\n log_filename = \"loguru.log\"\n log_path = \"log\"\n if(not os.path.exists):\n os.mkdir(log_path)\n log_fullpath= f\"{log_path}/{log_filename}\"\n logger.add(log_fullpath)\n else:",
"detail": "module.log",
"documentation": {}
},
Expand Down
3 changes: 2 additions & 1 deletion module/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
"""

def init():
logger.remove(0)
if(context.config["Log"]):
log_filename = "loguru.log"
log_path = "log"
if(not os.path.exists):
os.mkdir(log_path)
log_fullpath= f"{log_path}/{log_filename}"

logger.remove(0)

logger.add(log_fullpath)
else:
logger.info("Log file disabled")
Expand Down

0 comments on commit 54fcc4a

Please sign in to comment.