Source File
zapjournal.go
Belonging Package
go.pact.im/x/zapjournal
// Package zapjournal provides a zapcore.Core implementation that sends logs to// systemd-journald socket.package zapjournalimport ()// UnixConn is the subset of the net.UnixConn interface used by the zap.Core// implementation that sends logs to journald.type UnixConn interface {WriteMsgUnix(b, oob []byte, addr *net.UnixAddr) (n, oobn int, err error)}// Bind is a convenience function that returns a new unixgram client connection// for communicating with journald.func () (*net.UnixConn, error) {return net.ListenUnixgram("unixgram", &net.UnixAddr{Net: "unixgram"})}// NewCore returns a new core that uses default configuration with the given// options applied and sends logs to journald socket. On non-Linux platforms// it always returns no-op implementation.func ( UnixConn, ...Option) zapcore.Core {:= defaultConfigfor , := range {(&)}return newCoreWithConfig(, )}// NewCoreWithConfig returns a new core that uses the given configuration and// sends logs to journald socket. If c is nil, default values are used. On// non-Linux platforms it always returns no-op implementation.func ( UnixConn, *Config) zapcore.Core {:= defaultConfigif != nil {= *}return newCoreWithConfig(, )}// Available checks whether the journald socket exists at the default path on// the current system.func () (bool, error) {return checkEnabled()}
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64)