Diag-Client-Lib
logger.h
Go to the documentation of this file.
1 /* Diagnostic Client library
2  * Copyright (C) 2024 Avijit Dey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 #ifndef DIAGNOSTIC_CLIENT_LIB_APPL_SRC_COMMON_LOGGER_H
9 #define DIAGNOSTIC_CLIENT_LIB_APPL_SRC_COMMON_LOGGER_H
10 
11 #include "utility/logger.h"
12 
13 namespace diag {
14 namespace client {
15 namespace logger {
16 
20 class DiagClientLogger final {
21  public:
26 
32  auto static GetDiagClientLogger() noexcept -> DiagClientLogger& {
33  static DiagClientLogger diag_client_logger_;
34  return diag_client_logger_;
35  }
36 
42  auto GetLogger() noexcept -> Logger& { return logger_; }
43 
44  private:
48  DiagClientLogger() = default;
49 
53  Logger logger_{"dcap"};
54 };
55 } // namespace logger
56 } // namespace client
57 } // namespace diag
58 #endif
Class to create a singleton logger for diag-client.
Definition: logger.h:20
DiagClientLogger()=default
Construct an instance of DiagClientLogger.
static auto GetDiagClientLogger() noexcept -> DiagClientLogger &
Get the diag client logger instance.
Definition: logger.h:32
Logger logger_
Store the logger instance with context id.
Definition: logger.h:53
auto GetLogger() noexcept -> Logger &
Get the logger instance.
Definition: logger.h:42
Logger class that is used to log Dlt messages from the component.
Definition: logger.h:32
utility::logger::Logger Logger
Definition: logger.h:16