renderd7/log.hpp

30 lines
748 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
/// 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
/// 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
/// fmt_str: the formatted style
2021-07-23 15:58:16 +02:00
std::string format(const std::string& fmt_str, ...);
private:
std::string filename;
};