Merge pull request #138 from juRiii/master
log: Fix StdlibAdapter parsing of Windows file paths when stdlib log has the Llongfile flag set.
Chris Hines
8 years ago
94 | 94 |
const (
|
95 | 95 |
logRegexpDate = `(?P<date>[0-9]{4}/[0-9]{2}/[0-9]{2})?[ ]?`
|
96 | 96 |
logRegexpTime = `(?P<time>[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?)?[ ]?`
|
97 | |
logRegexpFile = `(?P<file>[^:]+:[0-9]+)?`
|
|
97 |
logRegexpFile = `(?P<file>.+:[0-9]+)?`
|
98 | 98 |
logRegexpMsg = `(: )?(?P<msg>.*)`
|
99 | 99 |
)
|
100 | 100 |
|
133 | 133 |
"file": "/a/b/c/d.go:23",
|
134 | 134 |
"msg": "hello world",
|
135 | 135 |
},
|
|
136 |
"2009/01/23 01:23:23.123123 C:/a/b/c/d.go:23: hello world": map[string]string{
|
|
137 |
"date": "2009/01/23",
|
|
138 |
"time": "01:23:23.123123",
|
|
139 |
"file": "C:/a/b/c/d.go:23",
|
|
140 |
"msg": "hello world",
|
|
141 |
},
|
|
142 |
"01:23:23.123123 C:/a/b/c/d.go:23: hello world": map[string]string{
|
|
143 |
"date": "",
|
|
144 |
"time": "01:23:23.123123",
|
|
145 |
"file": "C:/a/b/c/d.go:23",
|
|
146 |
"msg": "hello world",
|
|
147 |
},
|
|
148 |
"2009/01/23 01:23:23 C:/a/b/c/d.go:23: hello world": map[string]string{
|
|
149 |
"date": "2009/01/23",
|
|
150 |
"time": "01:23:23",
|
|
151 |
"file": "C:/a/b/c/d.go:23",
|
|
152 |
"msg": "hello world",
|
|
153 |
},
|
|
154 |
"2009/01/23 C:/a/b/c/d.go:23: hello world": map[string]string{
|
|
155 |
"date": "2009/01/23",
|
|
156 |
"time": "",
|
|
157 |
"file": "C:/a/b/c/d.go:23",
|
|
158 |
"msg": "hello world",
|
|
159 |
},
|
|
160 |
"C:/a/b/c/d.go:23: hello world": map[string]string{
|
|
161 |
"date": "",
|
|
162 |
"time": "",
|
|
163 |
"file": "C:/a/b/c/d.go:23",
|
|
164 |
"msg": "hello world",
|
|
165 |
},
|
136 | 166 |
} {
|
137 | 167 |
haveMap := subexps([]byte(input))
|
138 | 168 |
for key, want := range wantMap {
|
|
141 | 171 |
}
|
142 | 172 |
}
|
143 | 173 |
}
|
144 | |
}
|
|
174 |
}⏎
|