C/C++ API Reference
Loading...
Searching...
No Matches
config.h
1// Copyright 2021 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4// use this file except in compliance with the License. You may obtain a copy of
5// the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12// License for the specific language governing permissions and limitations under
13// the License.
14#pragma once
15
16#include <stdint.h>
17
19
20// These configuration options differ from the options in pw_log/options.h in
21// that these should be set at a global level in the build system rather than
22// at a module or compile unit level.
23
24// PW_LOG_LEVEL_DEFAULT controls the default value of PW_LOG_LEVEL.
25//
26// Defaults to PW_LOG_LEVEL_DEBUG.
27#ifndef PW_LOG_LEVEL_DEFAULT
28#define PW_LOG_LEVEL_DEFAULT PW_LOG_LEVEL_DEBUG
29#endif // PW_LOG_LEVEL_DEFAULT
30
31// PW_LOG_FLAGS_DEFAULT controls the default value of PW_LOG_FLAGS.
32//
33// For log statements like LOG_INFO that don't have an explicit argument, this
34// is used for the flags value.
35#ifndef PW_LOG_FLAGS_DEFAULT
36#define PW_LOG_FLAGS_DEFAULT 0
37#endif // PW_LOG_FLAGS_DEFAULT
38
39// PW_LOG_ENABLE_IF controls what logs are enabled
40//
41// This expression determines whether or not the statement is enabled and
42// should be passed to the backend.
43#ifndef PW_LOG_ENABLE_IF
44#define PW_LOG_ENABLE_IF(level, verbosity, module, flags) \
45 ((int32_t)(level) >= (int32_t)(verbosity))
46#endif // PW_LOG_ENABLE_IF
47