-
Notifications
You must be signed in to change notification settings - Fork 1
/
QsLogLevel.cpp
55 lines (52 loc) · 1.51 KB
/
QsLogLevel.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
54
55
#include "QsLogLevel.h"
#include <QString>
#include <QObject>
#include <cassert>
static const char TraceString[] = "TRACE";
static const char DebugString[] = "DEBUG";
static const char InfoString[] = "INFO ";
static const char WarnString[] = "WARN ";
static const char ErrorString[] = "ERROR";
static const char FatalString[] = "FATAL";
const char* QsLogging::LevelName(QsLogging::Level theLevel)
{
switch (theLevel) {
case QsLogging::TraceLevel:
return TraceString;
case QsLogging::DebugLevel:
return DebugString;
case QsLogging::InfoLevel:
return InfoString;
case QsLogging::WarnLevel:
return WarnString;
case QsLogging::ErrorLevel:
return ErrorString;
case QsLogging::FatalLevel:
return FatalString;
case QsLogging::OffLevel:
return "";
default: {
Q_ASSERT(!"bad log level");
return InfoString;
}
}
}
QString QsLogging::LocalizedLevelName(QsLogging::Level theLevel)
{
switch (theLevel) {
case QsLogging::TraceLevel:
return QObject::tr("Trace");
case QsLogging::DebugLevel:
return QObject::tr("Debug");
case QsLogging::InfoLevel:
return QObject::tr("Info");
case QsLogging::WarnLevel:
return QObject::tr("Warning");
case QsLogging::ErrorLevel:
return QObject::tr("Error");
case QsLogging::FatalLevel:
return QObject::tr("Fatal");
default:
return QString();
}
}