Events
Blip uses events instead of traditional logging.
Instead of,
log.Println("Error connecting to MySQL")
Blip emits an event like,
event.Errorf(event.LOST_MYSQL, "Cannot connect to MySQL")
Events are either “info” or errors.
By default, error events are printed to STDERR
.
Start blip
with the --log
option to print info events to STDOUT
, which simulates traditional logging.
An event receiver handles every event.
The default event receiver is event.Log
, which prints events as noted above: error events to STDERR
, and “info” events to STDOUT
if --log
.
To change (or implement different) Blip logging, implement a custom event receiver.
Implement the event.Receiver
interface, then call event.SetReceiver
before booting the server.
Registering a custom receive completely overrides the default receiver. Be sure your custom receiver handles all events.