Logging cleaned up
This sets the date format, and hase the log level, and log file as variables.
This commit is contained in:
parent
4f0441ae9d
commit
86b7b61fb1
|
@ -19,4 +19,9 @@ This is our current version trying to communicate between courier and mailman3.
|
|||
* This is not working
|
||||
* Reverting to previous formatting
|
||||
* No idea what steps we've gone through to get here.
|
||||
* Let's try again.
|
||||
* Let's try again.
|
||||
* OK, basicSettings all set at once.
|
||||
* This sorts it, now let's get a date format working
|
||||
* Now let's see if this works...
|
||||
* Date format set:
|
||||
* Level and File set in variable
|
|
@ -14,9 +14,13 @@
|
|||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'
|
||||
DATEFMT = '%Y-$M-$d %H:%m:%S'
|
||||
logging.basicConfig(filename='/opt/mailman/logs/courier-to-mailman.log', level=logging.INFO, format=FORMAT)
|
||||
# Format time and message
|
||||
FORMAT = '%(asctime)s %(message)s'
|
||||
# Set Date Format
|
||||
DATEFMT = '%Y-$m-$d %H:%M:%S %Z'
|
||||
LEVEL=logging.INFO
|
||||
LOGFILE='/opt/mailman/logs/courier-to-mailman.log'
|
||||
logging.basicConfig(filename=LOGFILE, level=LEVEL, format=FORMAT, datefmt=DATEFMT)
|
||||
|
||||
logger.info('format set to: %s', FORMAT)
|
||||
print('format set to: %s', FORMAT)
|
||||
|
|
Loading…
Reference in New Issue