/usr/share/gocode/src/go.pedge.io/lion/current/current.go is in golang-go.pedge-lion-dev 0.0~git20171203.2a81062-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | /*
Package currentlion implements basic integration with Current using plaintext syslog.
https://current.sh
*/
package currentlion // import "go.pedge.io/lion/current"
import (
"log/syslog"
"go.pedge.io/lion"
"go.pedge.io/lion/syslog"
)
const (
syslogNetwork = "tcp"
)
// NewPusher returns a new Pusher for current.
func NewPusher(
appName string,
syslogAddress string,
token string,
) (lion.Pusher, error) {
writer, err := syslog.Dial(
syslogNetwork,
syslogAddress,
syslog.LOG_INFO,
appName,
)
if err != nil {
return nil, err
}
return sysloglion.NewPusher(
writer,
sysloglion.PusherWithMarshaller(
NewMarshaller(
MarshallerWithToken(token),
MarshallerDisableNewlines(),
),
),
), nil
}
// MarshallerOption is an option for creating Marshallers.
type MarshallerOption func(*marshaller)
// MarshallerWithToken will add @current:token before every marshalled Entry.
// This is used for syslog output.
func MarshallerWithToken(token string) MarshallerOption {
return func(marshaller *marshaller) {
marshaller.token = token
}
}
// MarshallerDisableNewlines disables newlines after each marshalled Entry.
func MarshallerDisableNewlines() MarshallerOption {
return func(marshaller *marshaller) {
marshaller.disableNewlines = true
}
}
// NewMarshaller returns a new Marshaller that marshals messages into , appropriate
// to send to an io.Writer that can be tailed by the current cli tool.
func NewMarshaller(options ...MarshallerOption) lion.Marshaller {
return newMarshaller(options...)
}
|