File logger.hpp
File List > include > nebula_common > loggers > logger.hpp
Go to the documentation of this file
// Copyright 2024 TIER IV, Inc.
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// 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 <memory>
#include <sstream>
#include <string>
#define NEBULA_LOG_STREAM(log_func, stream_args) \
{ \
std::stringstream ss{}; \
ss << stream_args; \
log_func(ss.str()); \
}
namespace nebula::drivers::loggers
{
class Logger
{
public:
virtual ~Logger() = default;
virtual void debug(const std::string & message) = 0;
virtual void info(const std::string & message) = 0;
virtual void warn(const std::string & message) = 0;
virtual void error(const std::string & message) = 0;
virtual std::shared_ptr<Logger> child(const std::string & name) = 0;
};
} // namespace nebula::drivers::loggers