xlog

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package xlog is a simple wrapper for slog, it will create a slog.Logger with options

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts Options) *slog.Logger

New will create a new slog.Logger with options

Types

type Options

type Options struct {
	// Env will change the log output format, if Env is "local", log will output in text format, otherwise in json format
	Env string
	// Debug will change the log level to debug
	Debug bool
	// SlackToken is the Slack bot token, if it is set and SlackChannel exists, Warn and Error level will send to it
	SlackToken string
	// SlackChannel is the Slack channel id, if it is set and SlackToken exists, Warn and Error level will send to it
	SlackChannel string
	// Release is the release version of the service, it will be added to log fields
	Release string
	// ServiceName is the name of the service, it will be added to log fields
	ServiceName string
}

Options is the options for xlog, all options are optional

Jump to

Keyboard shortcuts

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