-
Notifications
You must be signed in to change notification settings - Fork 0
/
LogManager.h
44 lines (32 loc) · 1.17 KB
/
LogManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef __LOG_MANAGER_H__
#define __LOG_MANAGER_H__
// System includes.
#include <stdio.h>
// Engine includes.
#include "Manager.h"
namespace df {
const std::string LOGFILE_NAME = "dragonfly.log"; // defines the name of the log file dragonfly outputs
class LogManager : public Manager {
private:
LogManager(); // Private (a singleton).
LogManager(LogManager const&); // No copying.
void operator=(LogManager const&); // No assignment.
bool do_flush; // True if fflush after each write.
FILE *p_f; // Pointer to logfile structure.
public:
// If logfile is open, close it.
~LogManager();
// Get the one and only instance of the LogManager.
static LogManager &getInstance();
// Start up the LogManager (open logfile "dragonfly.log").
int startUp();
// Shut down the LogManager (close logfile).
void shutDown();
// Set flush of logfile after each write.
void setFlush(bool do_flush = true);
// Write to logfile. Supports printf() formatting.
// Return number of bytes written, -1 if error.
int writeLog(const char *fmt, ...);
};
} // end of namespace df
#endif // __LOG_MANAGER_H__