0% found this document useful (0 votes)
3 views1 page

Logging Verbosity Levels and Setup

The document outlines verbosity levels for logging, ranging from CRITICAL to UNSET. It includes a Python code snippet that sets up a logger with a SysLogHandler to send log messages to a local syslog server. The logger is configured to use the INFO level and a specific message format.

Uploaded by

Reiko11
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Logging Verbosity Levels and Setup

The document outlines verbosity levels for logging, ranging from CRITICAL to UNSET. It includes a Python code snippet that sets up a logger with a SysLogHandler to send log messages to a local syslog server. The logger is configured to use the INFO level and a specific message format.

Uploaded by

Reiko11
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

"""

Verbosity levels:
--------------------Level
Value
--------------------CRITICAL
50
ERROR
40
WARNING
30
INFO
20
DEBUG
10
UNSET
0
--------------------"""
import socket
#Local configuration
#import logging
#FORMAT = '%(asctime)s %(levelname)s: %(message)s'
#[Link](format=FORMAT, level=[Link])#, filename='/tmp/dmui.l
og') #/var/log/[Link]
#/var/log/[Link]
#exp
import logging
import [Link]
logger = [Link]('myLogger')
[Link]([Link])
#add handler to the logger socket (SOCK_STREAM for stream sockets and SOCK_DGRA
M)
handler = [Link](address=('localhost', 514), socktype=so
cket.SOCK_DGRAM)
#add formatter to the handler
FORMAT = '%(asctime)s %(levelname)s: %(message)s'
formatter = [Link](FORMAT)
#formatter = [Link]('Python: { "loggerName":"%(name)s", "asciTime":"%
(asctime)s", "pathName":"%(pathname)s", "logRec$
[Link] = formatter
[Link](handler)

You might also like