redlogger

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package redlogger implements a concurrent logging system.

Index

Constants

This section is empty.

Variables

View Source
var ErrHandling errorHandling // = continueOnError

Functions

func DoOrDie

func DoOrDie(err error) error

DoOrDie handles errors based on the value of ErrHandling by logging the error and either continuing or exiting.

func New added in v0.3.2

func New(w io.Writer) *ansi.AnsiWriter

Types

type ErrorHandling

type ErrorHandling interface {
	String() string
	Set()
}

ErrorHandling wraps error handling behavior.

type LogWriter

type LogWriter struct {
	// bufio.Writer // is a StringWriter
	MultiWriter
}

type MultiWriter

type MultiWriter interface {
	Write([]byte) (int, error)
	WriteString(string) (int, error)
}

func NewMultiWriter

func NewMultiWriter(writers ...io.Writer) MultiWriter

NewMultiWriter returns a MultiWriter that duplicates its writes to all the provided writers, similar to the Unix tee(1) command.

Write(p []byte) (n int, err error) // for bytes

MultiWriter implements the StringWriter interface:

WriteString(string) (int, error) // for strings

Each write is written to each listed writer, one at a time. If a listed writer returns an error, that overall write operation stops and returns the error; it does not continue down the list.

======================================================

Reference: go version go1.15.6  src/io/multi.go

Copyright 2010 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Jump to

Keyboard shortcuts

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