alphagov/govuk_crawler_worker — pull request #56 by mattbostock (2014-08-07 14:25:22+00:00)
Title: [#76505670] Implement logging levels

__NB__: Please merge __either__ this PR, or #, but not both. See # for another implementation.

* * *

Implement the following logging levels:

`DEBUG`, `INFO`, `WARNING`, `ERROR` and `FATAL`

`INFO` outputs to stdout; all other levels output to stderr.

The default log level output is ERROR and above; this can be tweaked by providing an integer value to the `-loglevel` flag. A value of `0` corresponds to `DEBUG` and `4` corresponds to `FATAL` (values 0-4 are
valid).

Note that I have only changed the main package to use these levels so that the other packages remain portable.

Also, move much as possible of the package initialisation to the `init()` function.

* * *

Also, prefer `log.Fatalln` to `log.Fatal` for consistency with our use of `log.Println`. Ensures that a new line
is printed after the log message.