renderd7/log.hpp

31 lines
827 B
C++
Raw Normal View History

2021-07-23 15:58:16 +02:00
#pragma once
#include <fstream>
#include <stdarg.h>
#include <string>
#include <time.h>
#include <unistd.h>
2021-07-25 00:13:11 +02:00
/** Log Class */
2021-07-23 15:58:16 +02:00
class Log
{
public:
2021-07-25 00:13:11 +02:00
/** Construct */
2021-07-23 15:58:16 +02:00
Log();
2021-07-25 00:13:11 +02:00
/** Deconstruct */
2021-07-23 15:58:16 +02:00
~Log();
2021-07-25 00:13:11 +02:00
/// Init the log file
2021-07-25 12:54:49 +02:00
/// \param filename name for the file
2021-07-23 15:58:16 +02:00
void Init(const char *filename);
2021-07-25 00:13:11 +02:00
/// Write Text to logfile
2021-07-25 18:34:47 +02:00
/// \param debug_text your text
2021-07-23 15:58:16 +02:00
void Write(std::string debug_text);
2021-07-25 00:13:11 +02:00
/// Get the date
2021-07-23 15:58:16 +02:00
std::string logDate(void);
2021-07-25 00:13:11 +02:00
/// Format to logstyle
2021-07-25 18:34:47 +02:00
/// \param fmt_str the formatted style
2021-07-23 15:58:16 +02:00
std::string format(const std::string& fmt_str, ...);
private:
2022-04-12 11:19:37 +02:00
/// \param filename the name of the logfile
2021-07-23 15:58:16 +02:00
std::string filename;
};