Gazebo Utils

API Reference

3.0.0~pre3
Logger.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef GZ_UTILS_LOG_LOGGER_HH_
18#define GZ_UTILS_LOG_LOGGER_HH_
19
20#include <spdlog/spdlog.h>
21#include <memory>
22#include <string>
23#include <gz/utils/config.hh>
24#include <gz/utils/ImplPtr.hh>
25#include <gz/utils/log/Export.hh>
26
27namespace gz
28{
29namespace utils
30{
31namespace log
32{
33inline namespace GZ_UTILS_VERSION_NAMESPACE {
34
38class GZ_UTILS_LOG_VISIBLE Logger
39{
42 public: explicit Logger(const std::string &_loggerName);
43
46 public: void SetLogDestination(const std::string &_filename);
47
50 public: std::string LogDestination() const;
51
54 public: [[nodiscard]] spdlog::logger &RawLogger() const;
55
58 public: [[nodiscard]] std::shared_ptr<spdlog::logger> RawLoggerPtr() const;
59
62 public: void SetConsoleSinkLevel(spdlog::level::level_enum _level);
63
66};
67} // namespace GZ_UTILS_LOG_VERSION_NAMESPACE
68} // namespace log
69} // namespace utils
70} // namespace gz
71
72#endif // GZ_UTILS_LOG_LOGGER_HH_