Skip to content
This repository was archived by the owner on Jun 14, 2022. It is now read-only.

Commit c0a33b4

Browse files
committed
updated README
1 parent b2ca0e4 commit c0a33b4

File tree

2 files changed

+31
-20
lines changed

2 files changed

+31
-20
lines changed

README.md

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Beautifully colored, quick and simple Python logging. This logger is based on [Python logging package](https://docs.python.org/3/library/logging.html)
44

5-
[![version](https://img.shields.io/badge/Version-1.2.7-lightgrey)](https://github.com/sinkingtitanic/qlogging)
5+
[![version](https://img.shields.io/badge/Version-1.2.8-lightgrey)](https://github.com/sinkingtitanic/qlogging)
66
[![build](https://img.shields.io/badge/Pypi%20Build-Stable-blue)](https://pypi.org/project/qlogging/)
77
[![python-version](https://img.shields.io/badge/Python-3^-success)](https://www.python.org/downloads/)
88
[![coverage](https://img.shields.io/badge/coverage-%25100-success)](https://pypi.org/project/qlogging/)
@@ -92,39 +92,50 @@ Output (output format: `<date> <time> | <file_name> | <function_name>,<line#>| <
9292
Customize your logger based on the following `get_logger()` function parameters
9393

9494
```
95-
def get_logger(level='info', logfile=None, logfilemode='a',
96-
loggingmode="short", format_str=None, format_date=None, colors=None):
95+
def get_logger(
96+
level="info",
97+
logfile=None,
98+
logfilemode="a",
99+
loggingmode="short",
100+
format_str=None,
101+
file_format_str=None,
102+
format_date=None,
103+
colors=None,
104+
logger_config=None,
105+
):
97106
"""
98107
returns Python logging based logger formatted with colors
99108
100-
:param level: (DEFAULT='info') str of logging level, each str option is mapped to Python logging levels, str options:
109+
:param level: (DEFAULT='info') str of logging level, each str option is mapped to Python logging levels, str options:
101110
'info': logging.INFO,
102-
'debug': logging.DEBUG,
103-
'warning': logging.WARNING,
104-
'error': logging.ERROR,
111+
'debug': logging.DEBUG,
112+
'warning': logging.WARNING,
113+
'error': logging.ERROR,
105114
'critical': logging.CRITICAL,
106115
'notset': logging.NOTSET
107116
:param logfile: (DEFAULT=None) str path where to save log file, example: '/tmp/my_log.log'
108-
:param logfilemode: (DEFAULT='a') str of log file writing mode, same as the ones documented at Python logging package. options:
109-
'a': appends to logfile
110-
'w': overwrites logfile
111-
:param loggingmode: (DEFAULT='short') str logging mode to be selected. options:
112-
'short': will use short str format ('{color}{asctime} {funcName},{lineno}| {message} {reset}') and short date format ('%H:%M:%S')
113-
'medium': will use long str format ('color}{asctime} | {filename:8} | {funcName},{lineno} | {message}{reset}') and long date format ('%Y-%m-%d %H:%M:%S')
117+
:param logfilemode: (DEFAULT='a') str of log file writing mode, same as the ones documented at Python logging package. options:
118+
'a': appends to logfile
119+
'w': overwrites logfile
120+
:param loggingmode: (DEFAULT='short') str logging mode to be selected. options:
121+
'short': will use short str format ('%(asctime)s %(funcName)s,%(lineno)s| %(message)s') and short date format ('%H:%M:%S')
122+
'medium': will use long str format ('%(asctime)s | %(filename)s | %(funcName)s,%(lineno)s | %(message)s') and long date format ('%Y-%m-%d %H:%M:%S')
114123
'manual': you need to set :param format_str: and :param format_date: yourself
115-
:param format_str: (DEFAULT=None) str of format logging string, only set this if you selected :param loggingmode: as 'manual'. example:
116-
'color}{asctime} | {filename:8} | {funcName},{lineno} | {message}{reset}'
117-
:param date_str: (DEFAULT=None) str of date logging string, only set this if you selected :param loggingmode: as 'manual'. example:
124+
:param format_str: (DEFAULT=None) str of format logging string for console, only set this if you selected :param loggingmode: as 'manual'. example (the style is always '%', see python logging module for more info):
125+
'%(asctime)s | %(filename)s | %(funcName)s,%(lineno)s | %(message)s'
126+
:param file_format_str: (DEFAULT=None) str of format logging string for logfile (if you keep it None, we will use what you passed in :param format_str:), only set this if you selected :param loggingmode: as 'manual'. example (the style is always '%', see python logging module for more info):
127+
'%(asctime)s | %(filename)s | %(funcName)s,%(lineno)s | %(message)s'
128+
:param date_str: (DEFAULT=None) str of date logging string, only set this if you selected :param loggingmode: as 'manual'. example:
118129
'%Y-%m-%d %H:%M:%S'
119-
:param colors: (DEFAULT=None) dict of color settings, only set this if you selected :param loggingmode: as 'manual'. example:
130+
:param colors: (DEFAULT=None) dict of color settings, only set this if you selected :param loggingmode: as 'manual'. example:
120131
{
121132
'DEBUG': Fore.CYAN + Style.BRIGHT,
122133
'INFO': Fore.GREEN + Style.BRIGHT,
123134
'WARNING': Fore.YELLOW + Style.BRIGHT,
124135
'ERROR': Fore.RED + Style.BRIGHT,
125136
'CRITICAL': Fore.RED + Back.WHITE + Style.BRIGHT,
126137
}
127-
:param logger_config: (DEFAULT=None) dict python logger config if you want to fully overwrite configs. example:
138+
:param logger_config: (DEFAULT=None) dict python logger config if you want to fully overwrite configs. example:
128139
{
129140
"version": 1,
130141
"disable_existing_loggers": False,
@@ -159,7 +170,7 @@ def get_logger(level='info', logfile=None, logfilemode='a',
159170
},
160171
}
161172
:return: formated Python logging instance
162-
"""
173+
"""
163174
```
164175

165176
## Alternatives

qlogging/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .qlogging import get_logger, config
2-
__version__ = "1.2.7"
2+
__version__ = "1.2.8"
33

0 commit comments

Comments
 (0)