@@ -122,7 +122,7 @@ func createAccessEntry(r *http.Request, start time.Time, statusCode int, err err
122122 url += "?" + r .URL .RawQuery
123123 }
124124 fields := logrus.Fields {
125- "type" : "access" ,
125+ TypeField : TypeAccess ,
126126 "@timestamp" : start ,
127127 "remote_ip" : getRemoteIP (r ),
128128 "host" : r .Host ,
@@ -163,7 +163,7 @@ func Call(r *http.Request, resp *http.Response, start time.Time, err error) {
163163// FlakyCall logs the result of an outgoing call and marks it as flaky
164164func FlakyCall (r * http.Request , resp * http.Response , start time.Time , err error ) {
165165 fields := fieldsForCall (r , resp , start , err )
166- fields ["flaky" ] = true
166+ fields [FlakyField ] = true
167167 logCall (fields , r , resp , err )
168168}
169169
@@ -173,7 +173,7 @@ func fieldsForCall(r *http.Request, resp *http.Response, start time.Time, err er
173173 url += "?" + r .URL .RawQuery
174174 }
175175 fields := logrus.Fields {
176- "type" : "call" ,
176+ TypeField : TypeCall ,
177177 "@timestamp" : start ,
178178 "host" : r .Host ,
179179 "url" : url ,
@@ -233,17 +233,17 @@ func Cacheinfo(url string, hit bool) {
233233 }
234234 Log .WithFields (
235235 logrus.Fields {
236- "type" : "cacheinfo" ,
237- "url" : url ,
238- "hit" : hit ,
236+ TypeField : TypeCacheinfo ,
237+ "url" : url ,
238+ "hit" : hit ,
239239 }).
240240 Debug (msg )
241241}
242242
243243// Application Return a log entry for application logs.
244244func Application (h http.Header ) * Entry {
245245 fields := logrus.Fields {
246- "type" : "application" ,
246+ TypeField : TypeApplication ,
247247 }
248248 return Log .WithFields (fields )
249249}
@@ -263,7 +263,7 @@ func LifecycleStart(appName string, args interface{}) {
263263 }
264264 }
265265
266- fields ["type" ] = "lifecycle"
266+ fields [TypeField ] = TypeLifecycle
267267 fields ["event" ] = "start"
268268 for _ , env := range LifecycleEnvVars {
269269 if os .Getenv (env ) != "" {
@@ -277,8 +277,8 @@ func LifecycleStart(appName string, args interface{}) {
277277// LifecycleStop logs the request to stop an application
278278func LifecycleStop (appName string , signal os.Signal , err error ) {
279279 fields := logrus.Fields {
280- "type" : "lifecycle" ,
281- "event" : "stop" ,
280+ TypeField : TypeLifecycle ,
281+ "event" : "stop" ,
282282 }
283283 if signal != nil {
284284 fields ["signal" ] = signal .String ()
@@ -310,8 +310,8 @@ func LifecycleStopped(appName string, err error) {
310310
311311func logApplicationLifecycleEvent (appName string , eventName string , err error ) {
312312 fields := logrus.Fields {
313- "type" : "lifecycle" ,
314- "event" : eventName ,
313+ TypeField : TypeLifecycle ,
314+ "event" : eventName ,
315315 }
316316
317317 if os .Getenv ("BUILD_NUMBER" ) != "" {
@@ -330,8 +330,8 @@ func logApplicationLifecycleEvent(appName string, eventName string, err error) {
330330// ServerClosed logs the closing of a server
331331func ServerClosed (appName string ) {
332332 fields := logrus.Fields {
333- "type" : "application" ,
334- "event" : "stop" ,
333+ TypeField : TypeApplication ,
334+ "event" : "stop" ,
335335 }
336336
337337 if os .Getenv ("BUILD_NUMBER" ) != "" {
0 commit comments