Part 1
요약·해설
전체 logger output과 QEMU command, filter·hexdump·performance semantics를 보존합니다.
Module · Instance
Error · Warning · Info · Debug
Timestamp · Hexdump · External logs
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
615FE9900576AB3926BBCDCBD2D005FBDC4A0706C47824E852F8D25D54A9739F
.. zephyr:code-sample:: logging
:name: Logging
:relevant-api: log_api log_ctrl
Output log messages to the console using the logging subsystem.
Overview
********
A simple application that demonstrates use of logging subsystem. It demonstrates
main features: severity levels, timestamping, module level filtering and
instance level filtering. It also showcases logging capabilities in terms of
performance.
Building and Running
********************
This project outputs multiple log message to the console. It can be built and
executed on QEMU as follows:
.. zephyr-app-commands::
:zephyr-app: samples/subsys/logging/logger
:host-os: unix
:board: qemu_x86
:goals: run
:compact:
Sample Output
=============
.. code-block:: console
Module logging showcase.
[00:00:00.106,051] <inf> sample_module: log in test_module 11
[00:00:00.106,054] <inf> sample_module: Inline function.
Disabling logging in the sample_module module
Function called again but with logging disabled.
Instance level logging showcase.
[00:00:00.106,200] <inf> sample_instance.inst1: Inline call.
[00:00:00.106,204] <inf> sample_instance.inst1: counter_value: 0
[00:00:00.106,209] <wrn> sample_instance.inst1: Example of hexdump:
01 02 03 04 |....
[00:00:00.106,214] <inf> sample_instance.inst2: Inline call.
[00:00:00.106,218] <inf> sample_instance.inst2: counter_value: 0
[00:00:00.106,223] <wrn> sample_instance.inst2: Example of hexdump:
01 02 03 04 |....
Changing filter to warning on sample_instance.inst1 instance.
[00:00:00.106,297] <wrn> sample_instance.inst1: Example of hexdump:
01 02 03 04 |....
[00:00:00.106,302] <inf> sample_instance.inst2: Inline call.
[00:00:00.106,307] <inf> sample_instance.inst2: counter_value: 1
[00:00:00.106,311] <wrn> sample_instance.inst2: Example of hexdump:
01 02 03 04 |....
Disabling logging on both instances.
Function call on both instances with logging disabled.
String logging showcase.
[00:00:01.122,316] <inf> main: Logging transient string:transient_string
Severity levels showcase.
[00:00:01.122,348] <err> main: Error message example.
[00:00:01.122,352] <wrn> main: Warning message example.
[00:00:01.122,355] <inf> main: Info message example.
Logging performance showcase.
[00:00:02.151,602] <inf> main: performance test - log message 0
Estimated logging capabilities: 42000000 messages/second
Logs from external logging system showcase.
[00:00:03.165,977] <err> ext_log_system: critical level log
[00:00:03.165,991] <err> ext_log_system: error level log, 1 arguments: 1
[00:00:03.166,006] <wrn> ext_log_system: warning level log, 2 arguments: 12
[00:00:03.166,025] <inf> ext_log_system: notice level log, 3 arguments: 105
[00:00:03.166,044] <inf> ext_log_system: info level log, 4 arguments : 1 24
Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
Part 3
한국어 전문 번역
개요
Zephyr logging subsystem의 주요 기능을 보여 주는 간단한 application입니다. Severity level, timestamp, module-level filtering, instance-level filtering과 logging 성능을 한 실행에서 확인합니다.
빌드 및 실행
여러 log message를 console에 출력하며 다음 command로 qemu_x86에서 build하고 실행합니다.
west build -b qemu_x86 samples/subsys/logging/logger
west build -t run
Sample 출력
처음에는 sample_module log를 출력한 뒤 module logging을 disable해 다음 function call의 log가 사라지는 것을 보여 줍니다. 이어 sample_instance.inst1과 inst2가 info와 hexdump를 출력합니다.
inst1 filter를 warning으로 바꾸면 해당 instance의 info는 숨고 warning hexdump만 남지만, inst2는 계속 info와 warning을 출력합니다. 두 instance를 모두 disable한 뒤에는 function을 호출해도 log가 나오지 않습니다.
그다음 transient string, error·warning·info severity, performance test와 external logging system 연동을 차례로 보여 줍니다. Example output의 초당 42,000,000 message 추정치는 특정 QEMU 실행 결과이지 모든 target의 보장값은 아닙니다.
Module logging showcase.
[00:00:00.106,051] <inf> sample_module: log in test_module 11
[00:00:00.106,054] <inf> sample_module: Inline function.
Disabling logging in the sample_module module
Function called again but with logging disabled.
Instance level logging showcase.
[00:00:00.106,200] <inf> sample_instance.inst1: Inline call.
[00:00:00.106,204] <inf> sample_instance.inst1: counter_value: 0
[00:00:00.106,209] <wrn> sample_instance.inst1: Example of hexdump:
01 02 03 04 |....
[00:00:00.106,214] <inf> sample_instance.inst2: Inline call.
[00:00:00.106,218] <inf> sample_instance.inst2: counter_value: 0
[00:00:00.106,223] <wrn> sample_instance.inst2: Example of hexdump:
01 02 03 04 |....
Changing filter to warning on sample_instance.inst1 instance.
[00:00:00.106,297] <wrn> sample_instance.inst1: Example of hexdump:
01 02 03 04 |....
[00:00:00.106,302] <inf> sample_instance.inst2: Inline call.
[00:00:00.106,307] <inf> sample_instance.inst2: counter_value: 1
[00:00:00.106,311] <wrn> sample_instance.inst2: Example of hexdump:
01 02 03 04 |....
Disabling logging on both instances.
Function call on both instances with logging disabled.
String logging showcase.
[00:00:01.122,316] <inf> main: Logging transient string:transient_string
Severity levels showcase.
[00:00:01.122,348] <err> main: Error message example.
[00:00:01.122,352] <wrn> main: Warning message example.
[00:00:01.122,355] <inf> main: Info message example.
Logging performance showcase.
[00:00:02.151,602] <inf> main: performance test - log message 0
Estimated logging capabilities: 42000000 messages/second
Logs from external logging system showcase.
[00:00:03.165,977] <err> ext_log_system: critical level log
[00:00:03.165,991] <err> ext_log_system: error level log, 1 arguments: 1
[00:00:03.166,006] <wrn> ext_log_system: warning level log, 2 arguments: 12
[00:00:03.166,025] <inf> ext_log_system: notice level log, 3 arguments: 105
[00:00:03.166,044] <inf> ext_log_system: info level log, 4 arguments : 1 24
QEMU를 종료하려면 CTRL+A를 누른 뒤 x를 입력합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.