-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Change logging config. * Some adjusts. * Remove a code smell.
- Loading branch information
Showing
9 changed files
with
50 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1 @@ | ||
"""Module docstring example, following Google's docstring style.""" | ||
import logging.config | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.abspath(".")) | ||
|
||
logging.config.fileConfig(fname="butterfree/logging.conf") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Logger funcion.""" | ||
|
||
import logging | ||
|
||
|
||
def __config(json_file_logs: bool = False) -> None: | ||
|
||
if json_file_logs: | ||
return logging.basicConfig( | ||
format='{"name": "%(name)s", "timestamp": "%(asctime)-15s", ' | ||
'"level": "%(levelname)s", "message": "%(message)s"}', | ||
level=logging.INFO, | ||
filename="../logging.json", | ||
) | ||
return logging.basicConfig( | ||
format="%(name)s:%(asctime)-15s:%(levelname)s:< %(message)s >", | ||
level=logging.INFO, | ||
) | ||
|
||
|
||
def __logger(name: str, file_logs: bool = False) -> logging.Logger: | ||
|
||
__config(file_logs) | ||
return logging.getLogger(name) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters