C/C++ API Reference
Loading...
Searching...
No Matches
glog_adapter.h
1// Copyright 2022 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 "pw_log/internal/glog_adapter.h"
17#include "pw_preprocessor/concat.h"
18
20
21// WARNING: Pigweed strongly recommends sticking to printf-style logging instead
22// of C++ stream-style Google Log logging unless absolutely necessary. These
23// macros are only provided for compatibility with non-embedded code. See
24// https://pigweed.dev/pw_log/ for more details.
25
39#define LOG(glog_level) \
40 _PW_LOG_GLOG(_PW_LOG_GLOG_DECLARATION_##glog_level, \
41 PW_CONCAT(GlogStreamingLog, __COUNTER__))
42
43#define LOG_IF(glog_level, expr) \
44 _PW_LOG_GLOG_IF(_PW_LOG_GLOG_DECLARATION_##glog_level, \
45 expr, \
46 PW_CONCAT(GlogStreamingLog, __COUNTER__))
47