C/C++ API Reference
Loading...
Searching...
No Matches
options.h
1// Copyright 2020 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
15// This file defines macros used to control the behavior of pw_log statements.
16// Files that use pw_log may define these macros BEFORE any headers are
17// #included to customize pw_log.
18//
19// For example, the following sets the log module name to "Foobar" and the
20// minimum log level to WARN:
21//
22// #define PW_LOG_MODULE_NAME "Foobar"
23// #define PW_LOG_LEVEL PW_LOG_LEVEL_WARN
24//
25// #include "foo/bar.h"
26// #include "pw_log/log.h"
27//
28// Users of pw_log should not include this header directly; include
29// "pw_log/log.h" instead. This header is separate from "pw_log/log.h" to avoid
30// circular dependencies when implementing the pw_log facade.
31#pragma once
32
33#include "pw_log/config.h"
34
36
37// These configuration options differ from the options in pw_log/config.h in
38// that these should be set at a module/compile unit level rather than a global
39// level level.
40
44#ifndef PW_LOG_MODULE_NAME
45#define PW_LOG_MODULE_NAME ""
46#endif // PW_LOG_MODULE_NAME
47
53#ifndef PW_LOG_LEVEL
54#define PW_LOG_LEVEL PW_LOG_LEVEL_DEFAULT
55#endif // PW_LOG_LEVEL
56
61#ifndef PW_LOG_FLAGS
62#define PW_LOG_FLAGS PW_LOG_FLAGS_DEFAULT
63#endif // PW_LOG_FLAGS
64
66
67// DEPRECATED: Use PW_LOG_FLAGS.
68// TODO: b/234876701 - Remove this macro after migration.
69#ifndef PW_LOG_DEFAULT_FLAGS
70#define PW_LOG_DEFAULT_FLAGS PW_LOG_FLAGS
71#endif // PW_LOG_DEFAULT_FLAGS