GNode library (C++)
Loading...
Searching...
No Matches
logger.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General
2 * Public License. The full license is in the file LICENSE, distributed with
3 * this software. */
4
20#pragma once
21
22#include <memory>
23#include <spdlog/sinks/stdout_color_sinks.h>
24#include <spdlog/spdlog.h>
25
26namespace gnode
27{
28
41class Logger
42{
43public:
51 static std::shared_ptr<spdlog::logger> &log();
52
53private:
54 // Private constructor to prevent direct instantiation
55 Logger() = default;
56
57 // Disable copy constructor
58 Logger(const Logger &) = delete;
59
60 // Disable assignment operator
61 Logger &operator=(const Logger &) = delete;
62
63 // Static member to hold the singleton instance
64 static std::shared_ptr<spdlog::logger> instance;
65};
66
67} // namespace gnode
Manages logging functionality using the spdlog library.
Definition logger.hpp:42
static std::shared_ptr< spdlog::logger > instance
Definition logger.hpp:64
Logger()=default
static std::shared_ptr< spdlog::logger > & log()
Retrieves the singleton instance of the logger.
Logger(const Logger &)=delete
Logger & operator=(const Logger &)=delete
Definition data.hpp:23