-
Notifications
You must be signed in to change notification settings - Fork 0
/
logger.cpp
41 lines (37 loc) · 1.11 KB
/
logger.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
#include "logger.h"
logger::logger()
{
}
///
/// Método -> logMessage
/// Parámetro -> type
/// Determina el tipo de mensaje que se va a escribir
/// Parametro -> message
/// Se especifica a fondo el mensaje, permite adicionar contenido al orginal
///
QString logger::logMessage(int type, QString message)
{
QString timestamp = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss");
QString messageLog;
switch (type) {
case LOG_INFO:
messageLog = QString("[" + timestamp + "] [INFO]: " + message);
break;
case LOG_WARNING:
messageLog = QString("[" + timestamp + "] [WARNING]: " + message);
break;
case LOG_ERROR:
messageLog = QString("[" + timestamp + "] [ERROR]: " + message);
break;
case LOG_DEBUG:
messageLog = QString("[" + timestamp + "] [DEBUG]: " + message);
break;
case LOG_TRACE:
messageLog = QString("[" + timestamp + "] [TRACE]: " + message);
break;
default:
messageLog = QString("[" + timestamp + "] [ERROR]: Something want wrong");
break;
}
return messageLog;
}