Categorygithub.com/git-hulk/logrus-hooks
modulepackage
0.0.0-20180828070556-6973c2ae08d5
Repository: https://github.com/git-hulk/logrus-hooks.git
Documentation: pkg.go.dev

# README

logrus-hooks

  • Rotate Hook, rotate the log file by daily(default) or hour
  • Source Hook, append the caller to log's message

How to use

package main

import (
    "github.com/Sirupsen/logrus"
    hooks "github.com/git-hulk/logrus-hooks"
)

func main() {
    logger := logrus.New()
    // Create rotate hook
    rotateHook, err := hooks.NewRotateHook(logger, "/www/mydir", "test")
    if err != nil {
        // do something and exit
    }
    logger.Hooks.Add(rotateHook)
    // Create source hook
    logger.Hooks.Add(hooks.NewSourceHook(logrus.InfoLevel))
    logger.Info("foo")
}

# Functions

No description provided by the author
No description provided by the author
No description provided by the author

# Constants

No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author