pulse

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Go added in v1.0.3

func Go(ctx context.Context, f func())

Go runs the given function in a separate goroutine and recovers from any panic, logging the panic message and stack trace.

Usage:

Go(ctx, func() {
    // Your code here
})

Types

type Logger

type Logger interface {
	// EnableDebug turns on debug logging.
	EnableDebug()
	// WithPrefix returns a logger that prefixes all log entries with the
	// given key-value pairs.
	WithPrefix(kvs ...any) Logger
	// Debug logs a debug message.
	Debug(msg string, kvs ...any)
	// Info logs an info message.
	Info(msg string, kvs ...any)
	// Error logs an error message.
	Error(err error, kvs ...any)
}

Interface used by pulse to write log entries.

func ClueLogger

func ClueLogger(logCtx context.Context) Logger

ClueLogger adapts a clue logger to a pulse logger.

func NoopLogger

func NoopLogger() Logger

NoopLogger returns a no-op logger.

func StdLogger

func StdLogger(logger *stdlog.Logger) Logger

StdLogger adapts a Go standard library logger to a pulse logger.

Jump to

Keyboard shortcuts

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