formatter

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 6 Imported by: 0

README

logrus-formatter

The formatter of logrus, like python's logging.

[INFO] 2023-05-30 05:59:28,99  [xx.go:40]:  messags

Installation

go get gitee.com/weidongkl/logrus-formatter

Usage

package main

import (
	formatter "gitee.com/weidongkl/logrus-formatter"
	"github.com/sirupsen/logrus"
)

func main() {
	log := logrus.New()
	log.SetReportCaller(true)
	log.SetFormatter(&formatter.Formatter{})
	log.Infoln("test messages")
}

For advanced usage, please refer to example

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter struct {
	TimestampFormat string
	LogFormat       string
}

func (Formatter) Format

func (m Formatter) Format(entry *logrus.Entry) ([]byte, error)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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