logger

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package logger uses channels to implement non-blocking logging. Adapted from https://youtu.be/zDCKZn4-dck.

Level: advanced Topics: design, buffered channels, os/signal

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

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

func New

func New(w io.Writer, buf int) *Logger

New creates a logger that will write logs to w. Buf is the size of logs buffer.

func (*Logger) Stop

func (l *Logger) Stop()

Stop stops accepting logs and waits for logs buffer to be written.

func (*Logger) Write added in v0.25.0

func (l *Logger) Write(log string)

Write writes the log. If the log buffer is full it prints a warning and exits.

Directories

Path Synopsis
Log handles logging gracefully.
Log handles logging gracefully.

Jump to

Keyboard shortcuts

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