implement custom logging formatter
supports custom log message formats for each loglevel and, by extension, custom ANSI codes and colors for errors and warnings (#304)
This commit is contained in:
@@ -1518,7 +1518,7 @@ Logging Configuration
|
||||
=========== =====
|
||||
Type ``object``
|
||||
|
||||
Example .. code::
|
||||
Examples .. code::
|
||||
|
||||
{
|
||||
"format": "{asctime} {name}: {message}",
|
||||
@@ -1527,10 +1527,21 @@ Example .. code::
|
||||
"encoding": "ascii"
|
||||
}
|
||||
|
||||
{
|
||||
"level": "debug",
|
||||
"format": {
|
||||
"debug" : "debug: {message}",
|
||||
"info" : "[{name}] {message}",
|
||||
"warning": "Warning: {message}",
|
||||
"error" : "ERROR: {message}"
|
||||
}
|
||||
}
|
||||
|
||||
Description Extended logging output configuration.
|
||||
|
||||
* format
|
||||
* Format string for logging messages
|
||||
* General format string for logging messages
|
||||
or a dictionary with format strings for each loglevel.
|
||||
|
||||
In addition to the default
|
||||
`LogRecord attributes <https://docs.python.org/3/library/logging.html#logrecord-attributes>`__,
|
||||
|
||||
@@ -148,8 +148,13 @@
|
||||
{
|
||||
"mode": "terminal",
|
||||
"log": {
|
||||
"format": "{name}: {message}",
|
||||
"level": "info"
|
||||
"level": "info",
|
||||
"format": {
|
||||
"debug" : "\u001b[0;37m{name}: {message}\u001b[0m",
|
||||
"info" : "\u001b[1;37m{name}: {message}\u001b[0m",
|
||||
"warning": "\u001b[1;33m{name}: {message}\u001b[0m",
|
||||
"error" : "\u001b[1;31m{name}: {message}\u001b[0m"
|
||||
}
|
||||
},
|
||||
"logfile": {
|
||||
"path": "~/gallery-dl/log.txt",
|
||||
|
||||
@@ -175,6 +175,7 @@
|
||||
"mode": "auto",
|
||||
"progress": true,
|
||||
"shorten": true,
|
||||
"log": "[{name}][{levelname}] {message}",
|
||||
"logfile": null,
|
||||
"unsupportedfile": null
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user