parser

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package parser provides utilities for parsing of structured log messsages generated by maddy.

Index

Constants

View Source
const (
	ISO8601_UTC = "2006-01-02T15:04:05.000Z"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MalformedMsg

type MalformedMsg struct {
	Desc string
	Err  error
}

func (MalformedMsg) Error

func (m MalformedMsg) Error() string

type Msg

type Msg struct {
	Stamp   time.Time
	Debug   bool
	Module  string
	Message string
	Context map[string]interface{}
}

func Parse

func Parse(line string) (Msg, error)

Parse parses the message from the maddy log file.

It assumes standard file output, including the [debug] tag and ISO 8601 timestamp at the start of each line. Timestamp is assumed to be in the UTC, as it is enforced by maddy.

JSON context values are unmarshalled without any additional processing, notably that means that all numbers are represented as float64.

Jump to

Keyboard shortcuts

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