| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#pragma once |
|
2
|
|
|
|
|
|
|
#include "log.h" |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
namespace panda { namespace log { |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
/* |
|
7
|
|
|
|
|
|
|
* SYNTAX OF TOKEN: %X or %xX or %.yX or %x.yX |
|
8
|
|
|
|
|
|
|
* where x and y are optional digits (default is 0), and X is one of the following letters: |
|
9
|
|
|
|
|
|
|
* %L - level |
|
10
|
|
|
|
|
|
|
* %M - module |
|
11
|
|
|
|
|
|
|
* if module has no name (root), removes x chars on the left and y chars on the right. |
|
12
|
|
|
|
|
|
|
* %F - function |
|
13
|
|
|
|
|
|
|
* %f - file |
|
14
|
|
|
|
|
|
|
* x=0: only file name |
|
15
|
|
|
|
|
|
|
* x=1: full path as it appeared during compilation |
|
16
|
|
|
|
|
|
|
* %l - line |
|
17
|
|
|
|
|
|
|
* %m - message |
|
18
|
|
|
|
|
|
|
* %t - current time |
|
19
|
|
|
|
|
|
|
* x=0: YYYY-MM-DD HH:MM:SS |
|
20
|
|
|
|
|
|
|
* x=1: YY-MM-DD HH:MM:SS |
|
21
|
|
|
|
|
|
|
* x=2: HH:MM:SS |
|
22
|
|
|
|
|
|
|
* x=3: UNIX TIMESTAMP |
|
23
|
|
|
|
|
|
|
* x=4: YYYY/MM/DD HH:MM:SS |
|
24
|
|
|
|
|
|
|
* y>0: high resolution time, adds fractional part after seconds with "y" digits precision |
|
25
|
|
|
|
|
|
|
* %T - current thread id |
|
26
|
|
|
|
|
|
|
* %p - current process id |
|
27
|
|
|
|
|
|
|
* %P - current process title |
|
28
|
|
|
|
|
|
|
* %c - start color |
|
29
|
|
|
|
|
|
|
* %C - end color |
|
30
|
|
|
|
|
|
|
*/ |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
extern string_view default_format; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
struct PatternFormatter : IFormatter { |
|
35
|
31
|
50
|
|
|
|
|
PatternFormatter (string_view fmt) : _fmt(string(fmt)) {} |
|
36
|
|
|
|
|
|
|
static string format (const string&, std::string&, const Info&); |
|
37
|
|
|
|
|
|
|
string format (std::string&, const Info&) const override; |
|
38
|
|
|
|
|
|
|
private: |
|
39
|
|
|
|
|
|
|
string _fmt; |
|
40
|
|
|
|
|
|
|
}; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
}} |