content_image/686024.jpg content_image/686025.jpg
## 1 Basic Logging Tutorial 

Logging is a means of tracking events that happen when some software runs. The software’s developer adds logging calls to their code to indicate that certain events have occurred. An event is described by a descriptive message which can optionally contain variable data (i.e. data that is potentially different for each occurrence of the event). Events also have an importance which the developer ascribes to the event; the importance can also be called the level or severity . 

## 1.1 When to use logging 

Logging provides a set of convenience functions for simple logging usage. These are debug() , info() , warning() , error() and critical() . To determine when to use logging, see the table below, which states, for each of a set of common tasks, the best tool to use for it. 

<img src='content_image/686024.jpg'>

The logging functions are named after the level or severity of the events they are used to track. The standard levels and their applicability are described below (in increasing order of severity): 

<img src='content_image/686025.jpg'>

The default level is$_{WARNING}$ , which means that only events of this level and above will be tracked, unless the logging package is configured to do otherwise. 

Events that are tracked can be handled in different ways. The simplest way of handling tracked events is to print them to the console. Another common way is to write them to a disk file. 

