Python serial 27-log log

A, log

1. Recommended sites: https: //www.cnblogs.com/yyds/p/6901864.html

The site is a log processing logging module Introduction

2.logging module provides logging module level functions, including the four major components.

Level 3 logs

(1) concern different users different program information

(2) :( grade level from small to large, the more to the more serious back) DEBUG \ INFO \ NOTICE \ WARING \ ERROR \ CRITICAL \ ALERT \ EMERGENCY

(3) I \ O operations should not be too frequent

(4) Log role:

. I debug; ii understand the operation of the software;.. Iii positioning problem analysis

(5) log information

. I time;. II sites; iii.level; iv content.

(6) Mature third party logs (multiple module is available)

log4j\log4php\logging

4.logging module

(1) log level (user defined)

DEBUG\INFO\WARING\ERROR\CRITICAL

(2) Initialization \ write log instances need to specify the level, only when the level is higher than or equal to the specified level will be recorded

(3) use

Direct use of the logging (the other components of the package); customize the logging four components directly

5.logging module-level log

Use the following several functions

 

logging.debug (msg, Arg *, ** kwargs)       # Create a DEBUG level log 

logging.info (msg, * Arg, ** kwargs)        # create a level INFO log 

logging.warning (msg, * Arg , ** kwargs)     # create a level WARNING log 

logging.error (msg, * Arg, ** kwargs)       # create a level ERROR log 

logging.critical (msg, * Arg, ** kwargs)    # create a log level is CRITICAL in 

logging.log (level, * Arg, ** kwargs)       # logging level to create a level of 

logging.basicConfig ( ** kwargs)          # one-time configuration of the Logger root 

logging.basicConfig ( ** kwargs) one-time configuration of the root logger

 

 

Only works when the first call

Do not configure the default value logger

i Output:. sys.stderr

ii level:. WARNING

iii format:. level: log_name: content

(2) Examples

 

logging.debug("This is a debug log")

#另一种写法

logging.log(logging.DEBUG,"This is a debug log")

 

Second, the source

d23_1_log.py

Address: https: //github.com/ruigege66/Python_learning/blob/master/d23_1_log.py

2.CSDN: https: //blog.csdn.net/weixin_44630050 (Xi Jun Jun Moods do not know - Rui)

3. Park blog: https: //www.cnblogs.com/ruigege0000/

4. Welcomes the focus on micro-channel public number: Fourier transform

Guess you like

Origin www.cnblogs.com/ruigege0000/p/11267410.html
log
log