2015-10-10 07:29:18 +00:00
|
|
|
package flog
|
|
|
|
|
|
|
|
|
|
|
|
type internalFlogger struct {
|
|
|
|
context map[string]interface{}
|
|
|
|
router Router
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-10-10 09:46:17 +00:00
|
|
|
// New returns an initialized Flogger.
|
2015-10-10 07:29:18 +00:00
|
|
|
func New(router Router, cascade ...interface{}) Flogger {
|
|
|
|
context := newContext(cascade...)
|
|
|
|
|
|
|
|
flogger := internalFlogger{
|
|
|
|
context:context,
|
|
|
|
router:router,
|
|
|
|
}
|
|
|
|
|
|
|
|
return &flogger
|
|
|
|
}
|
2015-10-14 02:16:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (flogger *internalFlogger) route(message string, moreContext map[string]interface{}) error {
|
|
|
|
|
|
|
|
context := newContext(flogger.context, moreContext)
|
|
|
|
|
|
|
|
return flogger.router.Route(message, context)
|
|
|
|
}
|