xxtelebot  1.4.1.0
A simple Telegram Bot implementation in C++
logger.h
1 #ifndef TGBOT_LOGGER_FACILITY_H
2 #define TGBOT_LOGGER_FACILITY_H
3 
4 #include <iostream>
5 #include <string>
6 
7 namespace tgbot {
12  class Logger {
13  private:
14  std::ostream *stream{&std::cout};
15  std::string dateFormat{"%Y/%m/%d %H:%M:%S"};
16 
17  public:
18  Logger() = default;
19 
20  ~Logger();
21 
25  Logger(Logger const &) = default; // YOU ARE NOT ENCOURAGED TO COPY THIS
26  Logger(Logger &&) = delete;
27 
28  Logger &operator=(Logger const &) = delete;
29 
30  Logger &operator=(Logger &&) = delete;
31 
36  void info(std::string const &logInfo) const;
37 
42  void error(std::string const &logError) const;
43 
48  explicit operator bool() const;
49 
55  inline void setStream(std::ostream &newStream) { stream = &newStream; }
56 
61  inline void setDateFormat(std::string &newDateFormat) {
62  dateFormat = std::move(newDateFormat);
63  }
64  };
65 } // namespace tgbot
66 
67 #endif // TGBOT_LOGGER_FACILITY_H
void error(std::string const &logError) const
log some error...
Main tgbot namespace.
Definition: bot.h:13
void setDateFormat(std::string &newDateFormat)
set new date format, default is: "%Y/%m/%d %H:%M:%S"
Definition: logger.h:61
Logging facility for telegram-bot-api, see also: tgbot::methods::Api::getLogger() ...
Definition: logger.h:12
void info(std::string const &logInfo) const
log some info...
void setStream(std::ostream &newStream)
set new stream
Definition: logger.h:55