mirror of
https://tildegit.org/solderpunk/molly-brown.git
synced 2025-04-13 09:29:46 +00:00
Allow no access logging with empty string log file path.
This commit is contained in:
parent
443bfd4bbd
commit
3be10b82d7
2 changed files with 6 additions and 1 deletions
|
@ -216,7 +216,8 @@ examples of the appropriate syntax.
|
|||
* `AccessLog`: Path to access log file (default value `access.log`,
|
||||
i.e. in the current wrorking directory). Note that all intermediate
|
||||
directories must exist, Molly Brown won't create them for you. Set
|
||||
to `-` for logging to `stdout`.
|
||||
to `-` for logging to `stdout`, or to an empty string to disable
|
||||
access logging.
|
||||
* `ErrorLog`: Path to error log file. If set to an empty string (the
|
||||
default), Molly Brown will log errors to stderr (where they are
|
||||
easily captured by systemd or similar init systems). If set to a
|
||||
|
|
4
main.go
4
main.go
|
@ -52,6 +52,10 @@ func main() {
|
|||
errorLog := log.New(errorLogFile, "", log.Ldate | log.Ltime)
|
||||
|
||||
var accessLogFile *os.File
|
||||
// TODO: Find a more elegant/portable way to disable logging
|
||||
if config.AccessLog == "" {
|
||||
config.AccessLog = "/dev/null"
|
||||
}
|
||||
if config.AccessLog == "-" {
|
||||
accessLogFile = os.Stdout
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue