| 5 | | To use logging functions, include `io/log.h` and initialize the logging subsystem. After that, you can use the `log_msg` to do the logging. |
| | 8 | The logging messages are printed to screen (depending on kernel configuration) |
| | 9 | and are also written to files. |
| | 10 | To prevent flooding of the system with logging messages, the messages |
| | 11 | are assigned severity levels (see table below) and the user specifies how verbose the |
| | 12 | system shall be - i.e. to which detail are the messages actually printed. |
| | 13 | To allow more fine-grained tuning of what-to-print, the messages are |
| | 14 | directed to different logs that form a tree-like structure. |
| | 15 | It is possible to control reporting level (verbosity) of each log separately, giving user |
| | 16 | the ability to exactly specify which part of the system shall be monitored |
| | 17 | in the greatest detail. |
| | 18 | |
| | 19 | For example, a (hypothetical) USB keyboard driver can offer a separate log |
| | 20 | for each keyboard that is plugged in. |
| | 21 | Thus, user trying to find out why his special button does not work can |
| | 22 | specify that ''all'' messages for the special keyboard shall be printed |
| | 23 | but also suppress any other messages - namely from the other keyboard that |
| | 24 | works and which is used to control the system. |
| | 25 | |
| | 26 | Currently, following levels are recognised. |
| | 27 | |
| | 28 | ||= Name =||= Typical usage =|| |
| | 29 | || `LVL_FATAL` || Fatal error, program is not able to recover at all. || |
| | 30 | || `LVL_ERROR` || Serious error but the program can recover from it.[[BR]]E.g. driver cannot control one device but otherwise is healthy. || |
| | 31 | || `LVL_WARN` || Easily recoverable problem, such as one corrupted packet that can be skipped. || |
| | 32 | || `LVL_NOTE` || Message that does not indicate a problem, but should be printed at the default logging level. || |
| | 33 | || `LVL_DEBUG` || Debugging-purpose message. Not printed at the default logging level. Increasing logging level to LVL_DEBUG should not swamp the log. || |
| | 34 | || `LVL_DEBUG2` || More detailed debugging message. || |
| | 35 | |
| | 36 | |
| | 37 | == Going through existing logs == |
| | 38 | |
| | 39 | All logs are stored under the `/log/` directory and file name corresponds |
| | 40 | to the server/application where the messages originated. |
| | 41 | To examine these files, one can use `edit` or `cat`. |
| | 42 | |
| | 43 | The file contains the whole tree of the logs - each line is prefixed with |
| | 44 | severity level of the message and name of the log. |
| | 45 | |
| | 46 | '''Example''': running `tester` application with `logger1` test shall |
| | 47 | create a `/log/tester` file with dummy messages. |
| | 48 | The test tries to print message at every severity level, what is |
| | 49 | actually stored into the file depends on current settings (see below for more examples). |
| | 50 | |
| | 51 | |
| | 52 | == Changing reported level at boot time == |
| | 53 | |
| | 54 | The following currently works only for GRUB-based platforms. |
| | 55 | |
| | 56 | TODO - logger arguments |
| | 57 | |
| | 58 | == Changing reported level at run-time == |
| | 59 | |
| | 60 | TODO - logset |
| | 61 | |
| | 62 | == Using the C API == |
| | 63 | |
| | 64 | TODO log_msg, log_init |
| | 65 | |
| | 66 | |
| | 67 | == Behind the scene |
| | 68 | |
| | 69 | TODO - how logger, logset and log_*() works |
| | 70 | |
| | 71 | |
| | 72 | |
| | 73 | == Obsoleted == |
| | 74 | |
| | 75 | '''Information below is obsoleted and will be rewritten soon. ''' |
| | 76 | |
| | 77 | To use logging functions, include `io/log.h` and initialize the logging |
| | 78 | subsystem. After that, you can use the `log_msg` to do the logging. |
| 30 | | Currently, following levels are recognised. |
| 31 | | |
| 32 | | ||= Name =||= Typical usage =|| |
| 33 | | || `LVL_FATAL` || Fatal error, program is not able to recover at all. || |
| 34 | | || `LVL_ERROR` || Serious error but the program can recover from it.[[BR]]E.g. driver cannot control one device but otherwise is healthy. || |
| 35 | | || `LVL_WARN` || Easily recoverable problem, such as one corrupted packet that can be skipped. || |
| 36 | | || `LVL_NOTE` || Message that does not indicate a problem, but should be printed at the default logging level. || |
| 37 | | || `LVL_DEBUG` || Debugging-purpose message. Not printed at the default logging level. Increasing logging level to LVL_DEBUG should not swamp the log. || |
| 38 | | || `LVL_DEBUG2` || More detailed debugging message. || |
| 39 | | |