Dev (#12)
* changed over to package format and removed tools, added poetry * reformat into miner_interface project * add dist to .gitignore * update readme and finish reformatting * Added couple missing imports. (#13) * change name to pyasic Co-authored-by: upstreamdata <brett@upstreamdata.ca> Co-authored-by: Mika Impola <mika@impola.fi>
This commit is contained in:
31
pyasic/logger/__init__.py
Normal file
31
pyasic/logger/__init__.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import logging
|
||||
from pyasic.settings import DEBUG, LOGFILE
|
||||
|
||||
|
||||
def init_logger():
|
||||
if LOGFILE:
|
||||
logging.basicConfig(
|
||||
filename="logfile.txt",
|
||||
filemode="a",
|
||||
format="%(pathname)s:%(lineno)d in %(funcName)s\n[%(levelname)s][%(asctime)s](%(name)s) - %(message)s",
|
||||
datefmt="%x %X",
|
||||
)
|
||||
else:
|
||||
logging.basicConfig(
|
||||
format="%(pathname)s:%(lineno)d in %(funcName)s\n[%(levelname)s][%(asctime)s](%(name)s) - %(message)s",
|
||||
datefmt="%x %X",
|
||||
)
|
||||
|
||||
_logger = logging.getLogger()
|
||||
|
||||
if DEBUG:
|
||||
_logger.setLevel(logging.DEBUG)
|
||||
logging.getLogger("asyncssh").setLevel(logging.DEBUG)
|
||||
else:
|
||||
_logger.setLevel(logging.WARNING)
|
||||
logging.getLogger("asyncssh").setLevel(logging.WARNING)
|
||||
|
||||
return _logger
|
||||
|
||||
|
||||
logger = init_logger()
|
||||
Reference in New Issue
Block a user