Change to error logging behaviour (stderr instead of stdout, by default).
This commit is contained in:
parent
16bf8e0534
commit
443bfd4bbd
3 changed files with 8 additions and 7 deletions
|
@ -217,10 +217,11 @@ examples of the appropriate syntax.
|
|||
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`.
|
||||
* `ErrorLog`: Path to error log file (default value `error.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`.
|
||||
* `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
|
||||
file, note that all intermediate directories must exist, Molly Brown
|
||||
won't create them for you.
|
||||
* `GeminiExt`: Files with this extension will be served with a MIME
|
||||
type of `text/gemini` (default value `gmi`).
|
||||
* `MimeOverrides`: In this section of the config file, keys are path
|
||||
|
|
|
@ -63,7 +63,7 @@ func getConfig(filename string) (Config, error) {
|
|||
config.DefaultLang = ""
|
||||
config.DefaultEncoding = ""
|
||||
config.AccessLog = "access.log"
|
||||
config.ErrorLog = "error.log"
|
||||
config.ErrorLog = ""
|
||||
config.TempRedirects = make(map[string]string)
|
||||
config.PermRedirects = make(map[string]string)
|
||||
config.CGIPaths = make([]string, 0)
|
||||
|
|
4
main.go
4
main.go
|
@ -40,8 +40,8 @@ func main() {
|
|||
|
||||
// Open log files
|
||||
var errorLogFile *os.File
|
||||
if config.ErrorLog == "-" {
|
||||
errorLogFile = os.Stdout
|
||||
if config.ErrorLog == "" {
|
||||
errorLogFile = os.Stderr
|
||||
} else {
|
||||
errorLogFile, err = os.OpenFile(config.ErrorLog, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue