github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/worker/logforwarder/sink.go (about) 1 // Copyright 2016 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package logforwarder 5 6 import ( 7 "github.com/juju/juju/core/watcher" 8 "github.com/juju/juju/logfwd/syslog" 9 ) 10 11 // LogForwardConfig provides access to the log forwarding config for a model. 12 type LogForwardConfig interface { 13 // WatchForLogForwardConfigChanges return a NotifyWatcher waiting for the 14 // log forward configuration to change. 15 WatchForLogForwardConfigChanges() (watcher.NotifyWatcher, error) 16 17 // LogForwardConfig returns the current log forward configuration. 18 LogForwardConfig() (*syslog.RawConfig, bool, error) 19 } 20 21 type LogSinkSpec struct { 22 // Name is the name of the log sink. 23 Name string 24 25 // OpenFn is a function that opens a log sink. 26 OpenFn LogSinkFn 27 } 28 29 // LogSinkFn is a function that opens a log sink. 30 type LogSinkFn func(cfg *syslog.RawConfig) (*LogSink, error) 31 32 // LogSink is a single log sink, to which log records may be sent. 33 type LogSink struct { 34 SendCloser 35 }