Skip to content

Change to middleware.LoggerConfig broke my service #821

Closed
@moorara

Description

@moorara

Description

I noticed that recently a change has been made to middleware.LoggerConfig. So, we cannot specify the Format, and instead, we can only specify the Fields. This is breaking my service and my logging stack due to the fact that I need to rename some of the fields. For example, I need to rename time to timestamp because my other services are logging timestamp.

Checklist

  • Dependencies installed
  • No typos
  • Searched existing issues and docs

Expected behaviour

I would like to specify the format for middleware logger.

Actual behaviour

I can only specify the fields for middleware logger.

Steps to reproduce

The following does not work anymore:

e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
	Format: {"level":"INFO","res":{"statusCode":${status}},"req":{"method":"${method}","url":"${uri}","remote_addr":"${remote_ip}"},"responseTime":${latency},"timestamp":"${time_rfc3339}","message":"HTTP ${method} ${uri}"}
}))

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions