logger

package
v0.2.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const ConsoleType = "console"

ConsoleType defines console logger type name

View Source
const FileType = "file"

FileType defines file logger type name

View Source
const RedisType = "redis"

RedisType defines redis logger type name

Variables

This section is empty.

Functions

func NewConsole

func NewConsole() (io.Writer, io.Writer, error)

NewConsole does nothing, it's here for consistancy

func NewFile

func NewFile(stdout string, stderr string) (io.Writer, io.Writer, error)

NewFile open file and prepare logs writing

func NewRedis

func NewRedis(stdout string, stderr string) (io.WriteCloser, io.WriteCloser, error)

NewRedis create new redis backend and initialize connection

func RedisParseURL

func RedisParseURL(address string) (host string, channel string, err error)

RedisParseURL parse an url and returns interresting part after validation

Types

type Console

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

Console does nothing else that print logs on console stdout/stderr, there are no config

func (*Console) Write

func (c *Console) Write(data []byte) (n int, err error)

type File

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

File write stdout/stderr to files

func (*File) Write

func (c *File) Write(data []byte) (n int, err error)

Write forwards write to underlaying layer

type Loggers

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

Loggers keeps stdout and stderr backend list

func NewLoggers

func NewLoggers() *Loggers

NewLoggers initialize empty lists

func (*Loggers) Add

func (c *Loggers) Add(stdout io.Writer, stderr io.Writer)

Add adds a defined backend on the list

func (*Loggers) Log

func (c *Loggers) Log() cio.Creator

Log create the containers logs redirector

type Logs

type Logs struct {
	Type string    `json:"type"`
	Data LogsRedis `json:"data"`
}

Logs defines a custom backend with variable settings

type LogsRedis

type LogsRedis struct {
	// Stdout is the redis url for stdout (redis://host/channel)
	Stdout string `json:"stdout"`

	// Stderr is the redis url for stderr (redis://host/channel)
	Stderr string `json:"stderr"`
}

LogsRedis defines how to connect a redis logs backend

type Redis

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

Redis send stdout/stderr to a Redis PubSub channel

func (*Redis) Close

func (c *Redis) Close() error

Close closes redis connection

func (*Redis) Write

func (c *Redis) Write(data []byte) (int, error)

Write will write to the channel

Jump to

Keyboard shortcuts

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