logger

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(message string, fields ...zap.Field)

Debug is a function that logs a debug level message. It takes a message and a variadic parameter of fields.

func Error

func Error(message string, fields ...zap.Field)

Error is a function that logs an error level message. It takes a message and a variadic parameter of fields.

func Fatal

func Fatal(message string, fields ...zap.Field)

Fatal is a function that logs a fatal level message. It takes a message and a variadic parameter of fields. After logging the message, it calls os.Exit(1) to terminate the program.

func Info

func Info(message string, fields ...zap.Field)

Info is a function that logs an info level message. It takes a message and a variadic parameter of fields.

func Init

func Init(env string)

Init is a function that initializes the logger. It takes the environment name as a parameter. Depending on the environment, it sets up the logger for development or production. For development, it uses the built-in development configuration of zap. For production, it creates a new logger with a file and console syncer, and a JSON encoder. If the environment is not recognized, it logs a fatal error. Finally, it names the logger with the name from the configuration.

func Sync

func Sync() error

Sync is a function that syncs the logger. It returns an error if the sync fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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