logging

package
v44.23.4 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToStructured

func ToStructured(message string) map[string]interface{}

Convert an unstructured message to a structured message in a consistent fashion.

This returns a value of the shape {"textPayload": <message>}

func ToUnstructured

func ToUnstructured(message map[string]interface{}) string

Convert a structured message to an unstructured message in a consistent fashion.

This treats `textPayload` specially as the message in the message, and includes all other fields after that

Types

type Logger

type Logger interface {
	// Log an unstructured text message (not newline-terminated)
	LogUnstructured(message string)

	// Log a structured message.
	LogStructured(message map[string]interface{})
}

A Logger handles sending log output to an appropriate place, per user configuration. It must handle both structured (arbitrary JSON) and unstructured (plain text) inputs, and can produce whatever format is appropriate for the destination.

Jump to

Keyboard shortcuts

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