-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLocalGLogger.cpp
executable file
·54 lines (48 loc) · 1.6 KB
/
LocalGLogger.cpp
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
53
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: LocalGLogger.cpp
* Author: gedas
*
* Created on Šeštadienis, 2016, balandis 9, 15.46
*/
#include "LocalGLogger.h"
GServer::LocalGLogger::LocalGLogger(int debug) : GLogger(debug) {
// Nustatau pavadinima
this->className = this->className + ":LocalGLogger";
this->logDebug(this->className, "Objektas sukurtas");
}
GServer::LocalGLogger::~LocalGLogger() {
this->logDebug(this->className, "Objektas sunaikinamas");
}
void GServer::LocalGLogger::formMessage(std::string className,
std::string message, int type, std::string & resultString) {
// Kintamasis nusakantis kokio tipo atejo pranesimas
std::string tempString;
// Nustatau pranesimo tipa
switch (type) {
case INFO:
// Atejo informacijos pranesimas
tempString = "INFO";
break;
case ERROR:
// Atejo klaidos pranesimas
tempString = "ERROR";
break;
default:
// Skaitoma, kad atejo derinimo inforamcijos pranesimas
tempString = "DEBUG";
break;
}
// Formuoju pranesimo zinute
messageBuilder << "[" << this->getTime() << "] " << tempString << " [" <<
className << "] " << message << endl;
// Nustatau koks gavosi pranesimas
resultString = this->messageBuilder.str();
// Isvalau messageBuilder objekta
this->messageBuilder.str("");
this->messageBuilder.clear();
}