Skip to content

Add a custom timestamp format option on Logger Middleware #1046

Closed
@renathoaz

Description

@renathoaz

Would be nice if Logger middleware had a custom time format configuration option. I would like to set my own time configuration.

it would be like:

timestampFormat := "2006-01-02 15:04:05.00000"
e.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{
       Output: logger,
       TimestampFormat: timestampFormat ,
}))

on echo/middleware/logger.go something like that:

case "time_custom":
  return buf.WriteString(time.Now().Format(TimeStampFormat))

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions