forked from sersorrel/edmcoverlay2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from alexzk1/more_privates
More privates
- Loading branch information
Showing
6 changed files
with
112 additions
and
61 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# See: https://github.com/EDCD/EDMarketConnector/blob/main/PLUGINS.md | ||
# Use: from _logger import logger | ||
|
||
import logging | ||
import os | ||
|
||
from config import appname | ||
|
||
# This could also be returned from plugin_start3() | ||
__plugin_name = os.path.basename(os.path.dirname(__file__)) | ||
|
||
# A Logger is used per 'found' plugin to make it easy to include the plugin's | ||
# folder name in the logging output format. | ||
# NB: plugin_name here *must* be the plugin's folder name as per the preceding | ||
# code, else the logger won't be properly set up. | ||
logger = logging.getLogger(f"{appname}.{__plugin_name}") | ||
|
||
# If the Logger has handlers then it was already set up by the core code, else | ||
# it needs setting up here. | ||
if not logger.hasHandlers(): | ||
level = logging.INFO # So logger.info(...) is equivalent to print() | ||
|
||
logger.setLevel(level) | ||
logger_channel = logging.StreamHandler() | ||
logger_formatter = logging.Formatter( | ||
f"%(asctime)s - %(name)s - %(levelname)s - %(module)s:%(lineno)d:%(funcName)s: %(message)s" | ||
) | ||
logger_formatter.default_time_format = "%Y-%m-%d %H:%M:%S" | ||
logger_formatter.default_msec_format = "%s.%03d" | ||
logger_channel.setFormatter(logger_formatter) | ||
logger.addHandler(logger_channel) |
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
File renamed without changes.
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