Add JSON as access logging format
This commit is contained in:
parent
39388a2199
commit
a9216e24f5
7 changed files with 268 additions and 59 deletions
|
@ -88,10 +88,16 @@ func NewServer(globalConfiguration GlobalConfiguration) *Server {
|
|||
server.leadership = cluster.NewLeadership(server.routinesPool.Ctx(), globalConfiguration.Cluster)
|
||||
}
|
||||
|
||||
var err error
|
||||
server.accessLoggerMiddleware, err = accesslog.NewLogHandler(globalConfiguration.AccessLogsFile)
|
||||
if err != nil {
|
||||
log.Warnf("Unable to create log handler: %s", err)
|
||||
if globalConfiguration.AccessLogsFile != "" {
|
||||
globalConfiguration.AccessLog = &types.AccessLog{FilePath: globalConfiguration.AccessLogsFile, Format: accesslog.CommonFormat}
|
||||
}
|
||||
|
||||
if globalConfiguration.AccessLog != nil {
|
||||
var err error
|
||||
server.accessLoggerMiddleware, err = accesslog.NewLogHandler(globalConfiguration.AccessLog)
|
||||
if err != nil {
|
||||
log.Warnf("Unable to create log handler: %s", err)
|
||||
}
|
||||
}
|
||||
return server
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue