-
Notifications
You must be signed in to change notification settings - Fork 0
/
Log.h
52 lines (47 loc) · 1.56 KB
/
Log.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
45
46
47
48
49
50
51
52
/**********************************
* FILE NAME: Log.h
*
* DESCRIPTION: Header file of Log class
**********************************/
#ifndef _LOG_H_
#define _LOG_H_
#include "stdincludes.h"
#include "Params.h"
#include "Member.h"
/*
* Macros
*/
// number of writes after which to flush file
#define MAXWRITES 1
#define MAGIC_NUMBER "CS425"
#define DBG_LOG "dbg.log"
#define STATS_LOG "stats.log"
/**
* CLASS NAME: Log
*
* DESCRIPTION: Functions to log messages in a debug log
*/
class Log{
private:
Params *par;
bool firstTime;
public:
Log(Params *p);
Log(const Log &anotherLog);
Log& operator = (const Log &anotherLog);
virtual ~Log();
void LOG(Address *, const char * str, ...);
void logNodeAdd(Address *, Address *);
void logNodeRemove(Address *, Address *);
// success
void logCreateSuccess(Address * address, bool isCoordinator, int transID, string key, string value);
void logReadSuccess(Address * address, bool isCoordinator, int transID, string key, string value);
void logUpdateSuccess(Address * address, bool isCoordinator, int transID, string key, string newValue);
void logDeleteSuccess(Address * address, bool isCoordinator, int transID, string key);
// fail
void logCreateFail(Address * address, bool isCoordinator, int transID, string key, string value);
void logReadFail(Address * address, bool isCoordinator, int transID, string key);
void logUpdateFail(Address * address, bool isCoordinator, int transID, string key, string newValue);
void logDeleteFail(Address * address, bool isCoordinator, int transID, string key);
};
#endif /* _LOG_H_ */