xref: /aosp_15_r20/external/pigweed/pw_log_null/docs.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker.. _module-pw_log_null:
2*61c4878aSAndroid Build Coastguard Worker
3*61c4878aSAndroid Build Coastguard Worker-----------
4*61c4878aSAndroid Build Coastguard Workerpw_log_null
5*61c4878aSAndroid Build Coastguard Worker-----------
6*61c4878aSAndroid Build Coastguard Worker``pw_log_null`` is a ``pw_log`` backend that ignores all ``pw_log`` statements.
7*61c4878aSAndroid Build Coastguard WorkerThe backend implements ``PW_LOG`` with an empty inline function. Using an empty
8*61c4878aSAndroid Build Coastguard Workerfunction ensures that the arguments are evaluated and their types are correct.
9*61c4878aSAndroid Build Coastguard WorkerSince the function is inline in the header, the compiler will optimize out the
10*61c4878aSAndroid Build Coastguard Workerfunction call.
11*61c4878aSAndroid Build Coastguard Worker
12*61c4878aSAndroid Build Coastguard WorkerThis backend can be used to completely disable ``pw_log``, which may be helpful
13*61c4878aSAndroid Build Coastguard Workerin certain development situations (e.g. to avoid circular dependencies).
14*61c4878aSAndroid Build Coastguard Worker
15*61c4878aSAndroid Build Coastguard Worker.. tip::
16*61c4878aSAndroid Build Coastguard Worker  If you are concerned about the resource demands of logging, try tokenizing
17*61c4878aSAndroid Build Coastguard Worker  logs with :ref:`module-pw_tokenizer` and :ref:`module-pw_log_tokenized`
18*61c4878aSAndroid Build Coastguard Worker  instead of disabling logs completely. Tokenized logs provide exactly same
19*61c4878aSAndroid Build Coastguard Worker  information as plain text logs but use dramatically less resources.
20