jsonlog

package
v26.0.0-rc3+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONLog

type JSONLog struct {
	// Log is the log message
	Log string `json:"log,omitempty"`
	// Stream is the log source
	Stream string `json:"stream,omitempty"`
	// Created is the created timestamp of log
	Created time.Time `json:"time"`
	// Attrs is the list of extra attributes provided by the user
	Attrs map[string]string `json:"attrs,omitempty"`
}

JSONLog is a log message, typically a single entry from a given log stream.

func (*JSONLog) Reset

func (jl *JSONLog) Reset()

Reset all fields to their zero value.

type JSONLogs

type JSONLogs struct {
	Log     []byte    `json:"log,omitempty"`
	Stream  string    `json:"stream,omitempty"`
	Created time.Time `json:"time"`

	// json-encoded bytes
	RawAttrs json.RawMessage `json:"attrs,omitempty"`
}

JSONLogs marshals encoded JSONLog objects

func (*JSONLogs) MarshalJSONBuf

func (mj *JSONLogs) MarshalJSONBuf(buf *bytes.Buffer) error

MarshalJSONBuf is an optimized JSON marshaller that avoids reflection and unnecessary allocation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL