May 15, 2021 Revel
Revel supports four types of log information:
Here's an example of using logs in Revel:
now := time.Now()
revel.TRACE.Printf("%s", now.String())
The logger uses the go log by default .
The logger is configured in app.conf. For example:
app.name = sampleapp
[dev]
log.trace.output = stdout
log.info.output = stdout
log.warn.output = stderr
log.error.output = stderr
log.trace.prefix = "TRACE "
log.info.prefix = "INFO "
log.trace.flags = 10
log.info.flags = 10
[prod]
log.trace.output = off
log.info.output = off
log.warn.output = log/%(app.name)s.log
log.error.output = log/%(app.name)s.log
In a development environment:
In a production environment:
Modify
the log format based
on the tag constant. F
or example,
01:23:23 /a/b/c/d.go:23 Message
format, using the
Ltime | Llongfile = 2 | 8 = 10
Development status: