Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python logging variables extra

import logging

logger = logging.getLogger(__name__)

FORMAT = '%(MYVAR)s %(asctime)s - %(levelname)s - %(message)s'
logging.basicConfig(format=FORMAT, datefmt='%d/%m/%Y %H:%M:%S')

logger.warning("'Twas brillig, and the slithy toves", extra={'MYVAR': 'Jabberwocky'})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #logging #variables #extra
ADD COMMENT
Topic
Name
6+4 =