My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
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
#ifndef FORM_EDITOR_COMMON__LOGGER_H
#define FORM_EDITOR_COMMON__LOGGER_H

#include "Utils.h"

#define LLOG(text) ToLog(text)
#define LLOGF(text) ToLog(text, __FILE__, __LINE__, __FUNCTION__)
#define LDUMP(text) ToLog(String(#text) + " = " + AsString(text))
#define LERROR(text) ToLog(String(t_("ERROR: ")) + text, __FILE__, __LINE__, __FUNCTION__)
#define LWARNING(text) ToLog(String(t_("WARNING: ")) + text, __FILE__, __LINE__, __FUNCTION__)

static StaticMutex __LogMutex;
static bool __Created = false;
inline bool CreateLogFile()
{
Mutex::Lock __(__LogMutex);
if (__Created) return true;
FileOut f;
if (!f.Open(ConfigFileEx(GetFileTitle(GetExeFilePath()) + "Log.txt")))
{
LOG(t_("ERROR: LOG-file \"FormEditorLog.txt\" not created!"));
return false;
}
f.PutLine(t_("LOG created."));
f.Close();
return __Created = true;
}

inline String ToLog(const char *text)
{
Mutex::Lock __(__LogMutex);
CreateLogFile();
FileAppend f;
if (!f.Open(ConfigFileEx(GetFileTitle(GetExeFilePath()) + "Log.txt")))
return String(text);
f.PutLine(FormatTime(GetSysTime(), "DD.MM.YYYY hh:mm:ss ") + text);
f.Close();
return String(text);
}

inline String ToLog(const char *text, const char* file, int line, const char* method)
{
Mutex::Lock __(__LogMutex);
CreateLogFile();
FileAppend f;
if (!f.Open(ConfigFileEx(GetFileTitle(GetExeFilePath()) + "Log.txt")))
return String(text);
f.PutLine(FormatTime(GetSysTime(), "DD.MM.YYYY hh:mm:ss ") + text
+ NFormat(t_(" (file \"%s\", line %d: \"%s\")"), file, line, method));
f.Close();
return String(text) + " (доп. информация в лог-файле)";
}

#endif

Change log

r4180 by Sc0rch on Nov 17, 2011   Diff
MapRender: First release
(FormEditorCommon, FormEditorProperties,
Map, MapBG, MapCommon, MapEditor,
MapRenderTest.
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1683 bytes, 54 lines
Powered by Google Project Hosting