log

package
v0.16.5 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup()

Cleanup do clean up for any writers and SHOULD be called before program exit to make sure no lingering resource still opened while program exit and will lead to resource leakage.

func Off

func Off() context.Context

Off give signal to logger to not write log. Simply inject this to Activity, Runtime or Worker.

func SetOutput

func SetOutput(w io.WriteCloser)

SetOutput set the output of the logs to given writer. By default, will print to the predefined logs directory ./storage/logs/.

Types

type ActLogger

type ActLogger interface {
	// Info log given payload in INFO level.
	Info(Map)
}

ActLogger activity logger and can be accessed with Activity.

This logger may not often be used by most developers since this may only be used inside middleware.

func Activity

func Activity(c context.Context) ActLogger

Activity start ActLogger.

type Map added in v0.7.2

type Map map[string]any

Map construct map data structure with string as the key type.

type RunLogger

type RunLogger interface {
	// Info log given payload in INFO level.
	Info(Map)
	// Warning log given payload in WARNING level.
	Warning(Map)
	// Error log given payload in ERROR level.
	Error(Map)
}

RunLogger runtime logger and can be accessed with Runtime.

This logger may be the most widely used by developers since this can be used in almost anywhere in the system.

func Runtime

func Runtime(c context.Context) RunLogger

Runtime start RunLogger.

type WorkLogger

type WorkLogger interface {
	// Info log given payload in INFO level.
	Info(Map)
}

WorkLogger worker logger and can be accessed with Worker.

This logger may only be used in worker or job process.

func Worker

func Worker(c context.Context) WorkLogger

Worker start WorkLogger.

Jump to

Keyboard shortcuts

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