logger

package module
v0.0.0-...-a0bc3dc Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: AGPL-3.0 Imports: 13 Imported by: 14

README

logger

My first attempt at a logger package with the usability I want.

Usage

package main

import (
	"time"

	"github.com/brimstone/logger"
)

func main() {
	log := logger.Method("main")
	defer log.Profile(time.Now())

	log.Debug("A walrus appears",
		log.Field("animal", time.Now()),
	)

	log.Println("lol, so")
	time.Sleep(time.Second)
	log.Info("Just an info message, like, got this far")
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTP

func HTTP(h http.Handler) http.Handler

Types

type FieldPair

type FieldPair struct {
	// contains filtered or unexported fields
}

type Fields

type Fields logrus.Fields

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func New

func New(o ...*Options) *Logger

func (*Logger) Counter

func (l *Logger) Counter(key string, increment int64)

func (*Logger) Debug

func (l *Logger) Debug(msg string, fps ...FieldPair)

func (*Logger) Error

func (l *Logger) Error(msg string, fps ...FieldPair)

func (*Logger) Fatal

func (l *Logger) Fatal(args ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(s string, args ...interface{})

Method Fatalf[string ...interface {}] is missing

func (*Logger) Fatalln

func (l *Logger) Fatalln(msg ...interface{})

Method Fatalln[...interface {}] is missing

func (*Logger) Field

func (l *Logger) Field(key string, value interface{}) FieldPair

func (*Logger) Finfo

func (l *Logger) Finfo(w io.Writer, msg string, fps ...FieldPair)

func (*Logger) Flags

func (l *Logger) Flags()

Flags

func (*Logger) Gauge

func (l *Logger) Gauge(key string, value interface{})

func (*Logger) Info

func (l *Logger) Info(msg string, fps ...FieldPair)

func (*Logger) Output

func (l *Logger) Output(i int, s string) error

Output

func (*Logger) Panic

func (l *Logger) Panic(args ...interface{})

Panic

func (*Logger) Panicf

func (l *Logger) Panicf(s string, args ...interface{})

func (*Logger) Panicln

func (l *Logger) Panicln(msg ...interface{})

func (*Logger) Prefix

func (l *Logger) Prefix()

Prefix

func (*Logger) Print

func (l *Logger) Print(args ...interface{})

Print

func (*Logger) Printf

func (l *Logger) Printf(s string, args ...interface{})

func (*Logger) Println

func (l *Logger) Println(msg ...interface{})

func (*Logger) Profile

func (l *Logger) Profile(then time.Time)

func (*Logger) Recover

func (l *Logger) Recover(f func(message, method, filename string, linenumber int64))

func (*Logger) RemoveGauge

func (l *Logger) RemoveGauge(key string)

func (*Logger) SetFlags

func (l *Logger) SetFlags(i int)

func (*Logger) SetOutput

func (l *Logger) SetOutput(w io.Writer)

func (*Logger) SetPrefix

func (l *Logger) SetPrefix(s string)

func (*Logger) Warn

func (l *Logger) Warn(msg string, fps ...FieldPair)

type Options

type Options struct {
	File  bool
	Delay time.Duration
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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