logvac

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2017 License: MPL-2.0 Imports: 3 Imported by: 3

Documentation

Overview

Package logvac handles the adding, removing, and writing to drains. It also defines the common types used accross logvac.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDrain

func AddDrain(tag string, drain Drain)

AddDrain adds a drain to the listeners and sets its logger

func Close

func Close()

Close logvac and remove all drains

func Init

func Init() error

Initializes a logvac object

func RemoveDrain

func RemoveDrain(tag string)

RemoveDrain drops a drain

func WriteMessage

func WriteMessage(msg Message)

WriteMessage broadcasts to all drains in seperate go routines Returns once all drains have received the message, but may not have processed the message yet

Types

type Drain

type Drain func(Message)

Drain is a function that "drains a Message"

type Logger

type Logger interface {
	Fatal(string, ...interface{})
	Error(string, ...interface{})
	Warn(string, ...interface{})
	Info(string, ...interface{})
	Debug(string, ...interface{})
	Trace(string, ...interface{})
}

Logger is a simple interface that's designed to be intentionally generic to allow many different types of Logger's to satisfy its interface

type Logvac

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

Logvac defines the structure for the default logvac object

var Vac Logvac

Vac is the default logvac object

type Message

type Message struct {
	Time     time.Time `json:"time"`
	UTime    int64     `json:"utime"`
	Id       string    `json:"id"`  // ignoreifempty?
	Tag      string    `json:"tag"` // ignoreifempty? // []string?
	Type     string    `json:"type"`
	Priority int       `json:"priority"`
	Content  string    `json:"message"`
}

Message defines the structure of a log message

Jump to

Keyboard shortcuts

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