blob: 05116588db13bc42c3f13303a94662fcc685f31a [file] [log] [blame]
// Copyright 2022 The Pigweed Authors
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
#pragma once
#include "pw_log/internal/glog_adapter.h"
#include "pw_preprocessor/concat.h"
// WARNING: Pigweed strongly recommends sticking to printf-style logging instead
// of C++ stream-style Google Log logging unless absolutely necessary. These
// macros are only provided for compatibility with non-embedded code. See
// for more details.
// A subset of the streaming Google logging (glog) macros are supported:
// - LOG(glog_level)
// - LOG_IF(glog_level, condition)
// The supported glog levels are DEBUG, INFO, WARNING, ERROR, FATAL & DFATAL
// This means the following are NOT supported:
// - glog level DFATAL
// - {D,P,SYS}LOG*
// - {,D}VLOG*
// - {,D}CHECK*
#define LOG(glog_level) \
PW_CONCAT(GlogStreamingLog, __COUNTER__))
#define LOG_IF(glog_level, expr) \
expr, \
PW_CONCAT(GlogStreamingLog, __COUNTER__))