Skip to content

Add a custom timestamp format option on Logger Middleware #1046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
renathoaz opened this issue Jan 15, 2018 · 1 comment
Closed

Add a custom timestamp format option on Logger Middleware #1046

renathoaz opened this issue Jan 15, 2018 · 1 comment
Assignees

Comments

@renathoaz
Copy link

renathoaz commented Jan 15, 2018

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))
@vishr vishr self-assigned this Jan 17, 2018
vishr pushed a commit that referenced this issue Feb 19, 2018
* [Add] custom time stamp format

* [Update] property name & default value & comment about custom logger
@vishr
Copy link
Member

vishr commented Feb 19, 2018

Fixed in #1066

@vishr vishr closed this as completed Feb 19, 2018
vishr pushed a commit that referenced this issue Mar 12, 2018
Enhancements:
    Implemented Response#After()
    Dynamically add/remove proxy targets
    Rewrite rules for proxy middleware
    Add ability to extract key from a form field
    Implemented rewrite middleware
    Adds a separate flag for the 'http/https server started on' message (#1043)
    Applied a little DRY to the redirect middleware (#1053) and tests (#1055)
    Simplify dep fetching (#1062)
    Add custom time stamp format #1046 (#1066)
    Update property name & default value & comment about custom logger
    Add X-Requested-With header constant
    Return error of context.File in c.contentDisposition
    Updated deps
    Updated README.md

Fixes:

    Fixed Response#Before()
    Fixed #990
    Fix href url from armor to echo (#1051)
    Fixed #1054
    Fixed #1052, dropped param alias feature
    Avoid redirect loop in HTTPSRedirect middleware (#1058)
    Fix deferring body close in middleware/compress test (#1063)
    Cleanup code (#1061)
    FIX - We must close gzip.Reader, only if no error (#1069)
    Fix formatting (#1071)
    Can be a fix for auto TLS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants