README.rst
1.. _logger_sample:
2
3Logging
4###########
5
6Overview
7********
8A simple application that demonstrates use of logging subsystem. It demonstrates
9main features: severity levels, timestamping, module level filtering and
10instance level filtering. It also showcases logging capabilities in terms of
11performance.
12
13Building and Running
14********************
15
16This project outputs multiple log message to the console. It can be built and
17executed on QEMU as follows:
18
19.. zephyr-app-commands::
20 :zephyr-app: samples/subsys/logging/logger
21 :host-os: unix
22 :board: qemu_x86
23 :goals: run
24 :compact:
25
26
27Sample Output
28=============
29
30.. code-block:: console
31
32 Module logging showcase.
33 [00:00:00.106,051] <inf> sample_module: log in test_module 11
34 [00:00:00.106,054] <inf> sample_module: Inline function.
35 Disabling logging in the sample_module module
36 Function called again but with logging disabled.
37 Instance level logging showcase.
38 [00:00:00.106,200] <inf> sample_instance.inst1: Inline call.
39 [00:00:00.106,204] <inf> sample_instance.inst1: counter_value: 0
40 [00:00:00.106,209] <wrn> sample_instance.inst1: Example of hexdump:
41 01 02 03 04 |....
42 [00:00:00.106,214] <inf> sample_instance.inst2: Inline call.
43 [00:00:00.106,218] <inf> sample_instance.inst2: counter_value: 0
44 [00:00:00.106,223] <wrn> sample_instance.inst2: Example of hexdump:
45 01 02 03 04 |....
46 Changing filter to warning on sample_instance.inst1 instance.
47 [00:00:00.106,297] <wrn> sample_instance.inst1: Example of hexdump:
48 01 02 03 04 |....
49 [00:00:00.106,302] <inf> sample_instance.inst2: Inline call.
50 [00:00:00.106,307] <inf> sample_instance.inst2: counter_value: 1
51 [00:00:00.106,311] <wrn> sample_instance.inst2: Example of hexdump:
52 01 02 03 04 |....
53 Disabling logging on both instances.
54 Function call on both instances with logging disabled.
55 String logging showcase.
56 [00:00:01.122,316] <inf> main: Logging transient string:transient_string
57 Severity levels showcase.
58 [00:00:01.122,348] <err> main: Error message example.
59 [00:00:01.122,352] <wrn> main: Warning message example.
60 [00:00:01.122,355] <inf> main: Info message example.
61 Logging performance showcase.
62 [00:00:02.151,602] <inf> main: performance test - log message 0
63 Estimated logging capabilities: 42000000 messages/second
64 Logs from external logging system showcase.
65 [00:00:03.165,977] <err> ext_log_system: critical level log
66 [00:00:03.165,991] <err> ext_log_system: error level log, 1 arguments: 1
67 [00:00:03.166,006] <wrn> ext_log_system: warning level log, 2 arguments: 12
68 [00:00:03.166,025] <inf> ext_log_system: notice level log, 3 arguments: 105
69 [00:00:03.166,044] <inf> ext_log_system: info level log, 4 arguments : 1 24
70
71Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
72