ddt  0.1
ddtLogger.hpp
Go to the documentation of this file.
1 /*
2  * Copyright ${year} SCISYS Deutschland GmbH
3  *
4  * The copyright of this file is vested in SCISYS Deutschland GmbH.
5  * Licensed under the SCISYS Space Germany License, Version 1.1 (the "License");
6  * you may not use this file except in compliance with the License.
7  *
8  * If a copy of this license was not distributed with this file, please contact
9  * SCISYS Deutschland GmbH.
10  *
11  * This file may only be reproduced in whole or in part, or stored in a
12  * retrieval system, or transmitted in any form, or by any means electronic,
13  * mechanical, photocopying or otherwise, either with the prior permission of
14  * SCISYS Deutschland GmbH or in accordance with the terms of a contract made
15  * with SCISYS Deutschland GmbH on use of this source code.
16  */
17 
18 #ifndef DDT_DDTLOGGER_HPP
19 #define DDT_DDTLOGGER_HPP
20 
21 #include <log4cplus/configurator.h>
22 #include <log4cplus/logger.h>
23 #include <log4cplus/loggingmacros.h>
24 #include <sys/stat.h>
25 
26 #include <algorithm>
27 #include <cctype>
28 
29 namespace ddt {
30 
71 class DdtLogger {
72  public:
80  static const int DDT_OFF = 6;
84  static const int DDT_FATAL = 5;
88  static const int DDT_ERROR = 4;
92  static const int DDT_WARN = 3;
96  static const int DDT_INFO = 2;
100  static const int DDT_DEBUG = 1;
104  static const int DDT_TRACE = 0;
108  static const int DDT_ALL = 0;
109 
116  DdtLogger(const std::string& loggerName);
117 
131  DdtLogger(const std::string& loggerName, char* applicationPath);
132 
136  virtual ~DdtLogger();
137 
143  static void writeToLogger(DdtLogger* logger, const int severity,
144  const std::string& message);
145 
149  void logTrace(const std::string& logMsg);
153  void logDebug(const std::string& logMsg);
157  void logInfo(const std::string& logMsg);
161  void logWarn(const std::string& logMsg);
165  void logError(const std::string& logMsg);
169  void logFatal(const std::string& logMsg);
170 
175  void configure(const std::string& module);
176 
182  void setLogLevel(const int logLevel);
183 
189  void write(const int severity, const std::string& message);
190 
191  private:
195  log4cplus::Logger logger;
196 
200  std::string module;
201 
207  int logLevel;
208 };
209 
210 } // namespace ddt
211 
212 #endif /* DDT_DDTLOGGER_HPP */
ddt::DdtLogger::~DdtLogger
virtual ~DdtLogger()
Definition: ddtLogger.cpp:99
ddt::DdtLogger::logFatal
void logFatal(const std::string &logMsg)
Definition: ddtLogger.cpp:116
ddt::DdtLogger::logTrace
void logTrace(const std::string &logMsg)
Definition: ddtLogger.cpp:101
ddt::DdtLogger
Definition: ddtLogger.hpp:71
ddt
Definition: ddtClient.hpp:36
ddt::DdtLogger::DdtLogger
DdtLogger(const std::string &loggerName)
Definition: ddtLogger.cpp:24
ddt::DdtLogger::DDT_ERROR
static const int DDT_ERROR
Definition: ddtLogger.hpp:88
ddt::DdtLogger::setLogLevel
void setLogLevel(const int logLevel)
Definition: ddtLogger.cpp:124
ddt::DdtLogger::DDT_DEBUG
static const int DDT_DEBUG
Definition: ddtLogger.hpp:100
ddt::DdtLogger::DDT_FATAL
static const int DDT_FATAL
Definition: ddtLogger.hpp:84
ddt::DdtLogger::writeToLogger
static void writeToLogger(DdtLogger *logger, const int severity, const std::string &message)
Definition: ddtLogger.cpp:184
ddt::DdtLogger::configure
void configure(const std::string &module)
Definition: ddtLogger.cpp:120
ddt::DdtLogger::logWarn
void logWarn(const std::string &logMsg)
Definition: ddtLogger.cpp:110
ddt::DdtLogger::logInfo
void logInfo(const std::string &logMsg)
Definition: ddtLogger.cpp:107
ddt::DdtLogger::write
void write(const int severity, const std::string &message)
Definition: ddtLogger.cpp:157
ddt::DdtLogger::logDebug
void logDebug(const std::string &logMsg)
Definition: ddtLogger.cpp:104
ddt::DdtLogger::logError
void logError(const std::string &logMsg)
Definition: ddtLogger.cpp:113
ddt::DdtLogger::DDT_ALL
static const int DDT_ALL
Definition: ddtLogger.hpp:108
ddt::DdtLogger::DDT_WARN
static const int DDT_WARN
Definition: ddtLogger.hpp:92
ddt::DdtLogger::DDT_INFO
static const int DDT_INFO
Definition: ddtLogger.hpp:96
ddt::DdtLogger::DDT_OFF
static const int DDT_OFF
Definition: ddtLogger.hpp:80
ddt::DdtLogger::DDT_TRACE
static const int DDT_TRACE
Definition: ddtLogger.hpp:104