Package-Level Type Names (total 7, in which 3 are exported)
/* sort exporteds by: | */
Config contains the options for the zapcore.Core implementation.
Level decides whether a given logging level is enabled. Defaults to
all levels enabled (i.e. debug level).
Path specifies the journal socket path to send logs to. Defaults to
"/run/systemd/journal/socket".
Prefix is the variable name prefix for journald fields. Defaults to
"X".
func NewCoreWithConfig(conn UnixConn, c *Config) zapcore.Core
func newCoreWithConfig(conn UnixConn, c Config) zapcore.Core
var defaultConfig
varsEncoder is a partial zapcore.Encoder implementation that encodes entries
to the systemd-journald wire format. Top-level fields are set as variables
with the configured prefix with open namespaces appended, while composite
values (arrays and objects) and reflected values are encoded as JSON.
Note that, in JSON mode, numeric values (float, complex, int) are encoded as
strings. This addresses the limitations of JSON encoding, i.e. the lack of
complex numbers, NaN and Inf, and integer interoperability. This does not
apply to the reflected values though, that use standard library for encoding.
buf holds the encoded variables.
hdr, if non zero, is an index to buf that is used in endVar to write
the length of the data appended since beginVar.
json encoder is used to encode composite values (objects and arrays).
prefix is appended to variable names.
(*varsEncoder) AddArray(key string, marshaler zapcore.ArrayMarshaler) error(*varsEncoder) AddBinary(key string, value []byte)(*varsEncoder) AddBool(key string, value bool)(*varsEncoder) AddByteString(key string, value []byte)(*varsEncoder) AddComplex128(key string, value complex128)(*varsEncoder) AddComplex64(key string, value complex64)(*varsEncoder) AddDuration(key string, value time.Duration)(*varsEncoder) AddFloat32(key string, value float32)(*varsEncoder) AddFloat64(key string, value float64)(*varsEncoder) AddInt(key string, value int)(*varsEncoder) AddInt16(key string, value int16)(*varsEncoder) AddInt32(key string, value int32)(*varsEncoder) AddInt64(key string, value int64)(*varsEncoder) AddInt8(key string, value int8)(*varsEncoder) AddObject(key string, marshaler zapcore.ObjectMarshaler) error(*varsEncoder) AddReflected(key string, value any) error(*varsEncoder) AddString(key, value string)(*varsEncoder) AddTime(key string, value time.Time)(*varsEncoder) AddUint(key string, value uint)(*varsEncoder) AddUint16(key string, value uint16)(*varsEncoder) AddUint32(key string, value uint32)(*varsEncoder) AddUint64(key string, value uint64)(*varsEncoder) AddUint8(key string, value uint8)(*varsEncoder) AddUintptr(key string, value uintptr)(*varsEncoder) OpenNamespace(key string)(*varsEncoder) addComplex(key string, value complex128, bitSize int)(*varsEncoder) addFloat(key string, value float64, bitSize int)
beginMultilineVar starts a multi-line variable.
beginSinglelineVar starts a single-line variable.
beginVar starts a single-line or multi-line variable. It should not be used
directly. Instead, call the convenience functions beginSinglelineVar and
beginMultilineVar. Each call should have a corresponding endVar. Nested
variables are not allowed.
encodeEntry encodes the entry using the underlying buffer as the initial
state. Note that it copies the internal buffer and does not mutate it. The
resulting encoder is owned by the caller.
(*varsEncoder) encodeEntryVars(ent zapcore.Entry)
endVar ends a variable. Both single-line and multi-line variables are
supported.
*varsEncoder : go.uber.org/zap/zapcore.ObjectEncoder
func cloneVarsEncoder(e *varsEncoder) *varsEncoder
func getVarsEncoder(prefix string) *varsEncoder
func cloneVarsEncoder(e *varsEncoder) *varsEncoder
func putVarsEncoder(e *varsEncoder)
Package-Level Functions (total 26, in which 7 are exported)
Available checks whether the journald socket exists at the default path on
the current system.
Bind is a convenience function that returns a new unixgram client connection
for communicating with journald.
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.
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.
appendUpperSnakeVarName appends s in upper snake case to dst.
appendVarName appends sanitized variable names to the dst and returns the
resulting byte slice.
base64Append is an append-style function for base64 encoding.
See also https://go.dev/issue/19366
checkEnabled returns true if journald socket exists on the current system.
cloneVarsEncoder clones the given varsEncoder, using the pooled objects when
possible. It must not be called on varsEncoders between beginVar and endVar
calls.
getVarsEncoder returns a new varsEncoder instance from the pool with the
given variable prefix set.
isAllowedVarNameByte checks whether c is allowed variable name character
before converting to upper case snake.
isDigitASCII checks whether c is an ASCII digit.
isLowerASCII checks whether c is a lower case ASCII letter.
isSocketSpaceError checks whether the error is signaling an "overlarge
message" condition.
isUpperASCII checks whether c is an upper case ASCII letter.
lowerToUpperASCII converts c to an upper case ASCII character, assuming that c is
a lower case letter.
putVarsEncoder puts the varsEncoder instance back to the pool if possible.
sanitizeVarName sanitizes the variable name to be a valid input for
appendUpperSnakeVarName. It also trims characters that would be converted to
underscore.
shouldConvertToUnderscore checks whether c should be converted to underscore.
strconvAppendComplex is an append-style function for strconv.FormatComplex
that is missing in the standard library.
strconvAppendUintptr is an append-style convenience function for uintptr
values and strconv.AppendUint.
Package-Level Variables (total 2, neither is exported)
defaultConfig is the default configuration that we use if Config is nil.
varsEncoderPool is a pool of varsEncoder objects with fixed buffer capacity.
Package-Level Constants (total 13, none are exported)
defaultPrefix is the default variable name prefix. It is also used if the
variable name starts with with underscore or is empty in appendVarName.
hdrLen is the size of the length header for a multi-line variable. The header
is a single 64-bit little endian integer.
memfdName is a name used for memfd file descriptor.
pooledBufferCapacity is the capacity required for the encoder to be pooled.
This is necessary since the operation of sync.Pool assumes that the memory
cost of each element is approximately the same in order to be efficient.
See https://go.dev/issue/23199
Severity levels used in PRIORITY field for syslog compatibility.
Severity levels used in PRIORITY field for syslog compatibility.
Severity levels used in PRIORITY field for syslog compatibility.
Severity levels used in PRIORITY field for syslog compatibility.
Severity levels used in PRIORITY field for syslog compatibility.
Severity levels used in PRIORITY field for syslog compatibility.
Severity levels used in PRIORITY field for syslog compatibility.
Severity levels used in PRIORITY field for syslog compatibility.
socketPath is the default socket path.
The pages are generated with Goldsv0.4.9. (GOOS=linux GOARCH=amd64)