version 0.1.0-alpha
This commit is contained in:
parent
b966316ed0
commit
b0348a6c71
2 changed files with 3 additions and 28 deletions
25
logger.py
25
logger.py
|
|
@ -1,25 +0,0 @@
|
|||
import logging
|
||||
|
||||
# Configure logging
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
# Create a StreamHandler and set its log level to DEBUG
|
||||
console_handler = logging.StreamHandler()
|
||||
console_handler.setLevel(logging.DEBUG)
|
||||
|
||||
# Create a formatter and attach it to the handler
|
||||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
console_handler.setFormatter(formatter)
|
||||
|
||||
# Create a logger and add the console handler
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.addHandler(console_handler)
|
||||
|
||||
# Log messages
|
||||
logger.debug("This is a debug message")
|
||||
logger.info("This is an info message")
|
||||
logger.warning("This is a warning message")
|
||||
logger.error("This is an error message")
|
||||
logger.critical("This is a critical message")
|
||||
|
||||
# https://www.samyakinfo.tech/blog/logging-in-python
|
||||
6
main.py
6
main.py
|
|
@ -1,4 +1,4 @@
|
|||
"""Zipssion.
|
||||
"""Zipssion
|
||||
|
||||
Usage:
|
||||
zipssion.py <file> [--quiet | --verbose] [--path=<path>] [--zip | --7zip | --tar.gz]
|
||||
|
|
@ -13,7 +13,7 @@ Options:
|
|||
--version show version
|
||||
--quiet print less text
|
||||
--verbose print more text
|
||||
--path <path> path to folder containing file [default: '/']
|
||||
--path=<path> path to folder containing file [default: '/']
|
||||
|
||||
"""
|
||||
from docopt import docopt
|
||||
|
|
@ -34,7 +34,7 @@ def config_log():
|
|||
console_handler.setLevel(logging.DEBUG)
|
||||
|
||||
# Create a formatter and attach it to the handler
|
||||
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
formatter = logging.Formatter('%(asctime)s \n %(name)s \n %(levelname)s \n %(message)s')
|
||||
console_handler.setFormatter(formatter)
|
||||
|
||||
# Create a logger and add the console handler
|
||||
|
|
|
|||
Loading…
Reference in a new issue