logfmt

package module
v0.0.0-...-867c8dd Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2020 License: MIT Imports: 4 Imported by: 2

README

GoDoc Go Report Card CI

logfmt

This module allows to encode a list of key/value pairs in logfmt format.

Example

package main

import (
	"bytes"
	"fmt"

	"github.com/arnumina/logfmt"
)

func main() {
	buf := bytes.Buffer{}
	logfmt.Encode(&buf, "year", 2020, "month", "July", "Tuesday", true)

	fmt.Println(buf.String())
}
year=2020 month="July" Tuesday=true

Copyright (c) 2020 Institut National de l'Audiovisuel

Documentation

Overview

Package logfmt allows to encode a list of key/value pairs in logfmt format.

The key must be a string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(buf *bytes.Buffer, kv ...interface{})

Encode allows to encode a list of key/value pairs in logfmt format.

If the provided list is odd, the value "@ODD" is added at the end of the list. Similarly, if the key is not a string of characters, it is replaced by the value "@KEY".

Types

This section is empty.

Jump to

Keyboard shortcuts

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