Revel provides four loggers:
- TRACE - debugging information only.
- INFO - informational.
- WARN - something unexpected but not harmful.
- ERROR - someone should take a look at this.
Each of these is a variable to a default go logger.
Loggers may be configured in app.conf. Here is an example:
In dev mode:
- even the most detailed logs will be shown.
- everything logged at info or trace will be prefixed with its logging level.
- default logger flag is 19 (
In prod mode:
- info and trace logs are ignored.
- both warnings and errors are appended to the log/sampleapp.log file.
- default logger flag is 3 (
To specify logger flags, you must calculate the flag value from
the flag constants. For example, to
01:23:23 /a/b/c/d.go:23 Message requires the flags
Ltime | Llongfile = 2 | 8 = 10.
Note: Revel creates the log directory if it does not already exists and if it’s not a absolute path then it prefix the Revel base path.
Turn Off Colorize
Revel provides a way to turn of the colorize in the logger.
Request Access Log
Revel provides request access log since v0.13, you can set the output via
app.conf. Request log will have following values of RequestStartTime, ClientIP, ResponseStatus, RequestLatency, HTTPMethod and URLPath.
- Issues tagged with