Back to godoc.org
cdr.dev/slog/v2 / internal / entryhuman

Package entryhuman

v2.0.2-0...-0d99925
Latest Go to latest

The latest major version is .

Published: Mar 31, 2020 | License: MIT | Module: cdr.dev/slog/v2

Overview

Package entryhuman contains the code to format slog.SinkEntry for humans.

Index

Constants

const TimeFormat = "2006-01-02 15:04:05.000"

TimeFormat is a simplified RFC3339 format.

func Fmt

func Fmt(w io.Writer, ent slog.SinkEntry) string

Fmt returns a human readable format for ent.

We never return with a trailing newline because Go's testing framework adds one automatically and if we include one, then we'll get two newlines. We also do not indent the fields as go's test does that automatically for extra lines in a log so if we did it here, the fields would be indented twice in test logs. So the Stderr logger indents all the fields itself.

func StripTimestamp

func StripTimestamp(ent string) (time.Time, string, error)

StripTimestamp strips the timestamp from entry and returns it and the rest of the entry.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier