-
Logging
Logging is a means of tracking events that happen when some software runs.
Events also have an
importance
which the developer ascribes to the events, theimportance
can also be called thelevels
orseverity
.The standard levels and their applicability are described below(in increasing order of severity):
Level When it’s used Numeric Value NOTSET 0 DEBUG Detailed information,typically of interest only when diagnosing problems 10 INFO Confirmation that things are working as expeted 20 WARNING(default level) An indication that something unexpencted happened, or indicative of some problem in the near future(e.g. ‘disk space low’), The software is still working as expected. 30 ERROR Due to a more serious problem, the software has not been able to perform some function. 40 CRITICAL A serious error,indicating that the program itself may be unable to continue running. 50 Events that are tracked can be handled in different ways,like printing them to the
console
or writing them to adisk file
. -
logging:Logging facility for Python
logging is the Python standard library implementing Logging.
The basic classes defined by the module,together with their functions,are listed below:
- Loggers expose the interface that application code directly uses.
- Handlers send the log records(created by loggers) to the appropriate destination.
- Filters provide a finer grained facility for determining which log records to output.
- Formatters specify the layout of log records in the final output.
-
Reference
Python中log的使用
最新推荐文章于 2024-07-01 17:35:18 发布