logger

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package logger has a few pre-built logging options

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewZapConsoleLogger

func NewZapConsoleLogger(level string) *zap.Logger

NewZapConsoleLogger creates a zap console logger

:param level: The logging level "info", "warn", or "error" default: "info"

Example

logger := NewZapConsoleLogger("info")
logger.Info("Some log message")

func NewZapFileLogger

func NewZapFileLogger(path string, level string, maxSizeMB int, maxAgeDays int, maxBackupsTotal int) *zap.Logger

NewZapFileLogger creates a zap file logger

:param path: The path and file name of the log
:param level: The logging level "debug", "info", "warn" or "error" default: "info"
:param maxSizeMB: The maximum log file size before rotation
:param maxAgeDays: The maximum days before file rotation
:param maxBackupsTotal: The maximum backups to keep

Example

logger := NewZapFileLogger("./some-log.log", "info", 5, 30, 3)
logger.Info("Some log message")

Types

This section is empty.

Jump to

Keyboard shortcuts

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