json

package
v0.0.0-...-deae2a3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package json provides a JSON log entry handler formatting JSON into the given Writer.

Index

Constants

View Source
const StandardTimeFormat = "2006-01-02T15:04:05.0000"

StandardTimeFormat represents the time format used in the handler by default.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler represents a JSON log entry handler formatting JSON into the given Writer.

func New

func New(w io.Writer) *Handler

New constructs a JSON handler formatting JSON into the given Writer.

func (*Handler) Handle

func (h *Handler) Handle(e slog.Entry) (err error)

Handle processes the log entry formatting JSON into the given Writer.

func (*Handler) SetAddingEOL

func (h *Handler) SetAddingEOL(eol bool)

SetAddingEOL defines whether an EOL character should be output to the writer after each JSON log entry output (default: false as the writer is assumed to be a JSON consumer rather than a plain vanilla writer).

func (*Handler) SetTimeFormat

func (h *Handler) SetTimeFormat(f string)

SetTimeFormat defines the formatting of time used for output into JSON.

Jump to

Keyboard shortcuts

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