logger

package module
v0.0.0-...-193d860 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2013 License: BSD-3-Clause Imports: 3 Imported by: 6

README

logger

logger is a simple level-logger.

Installation

$ go get github.com/gonuts/logger

Example

package main

import (
	"github.com/gonuts/logger"
)

func main() {
	msg := logger.New("foo")
	msg.SetLevel(logger.DEBUG)
	msg.Infof("an info message [%s]\n", "hello")
	msg.Debugf("a debug message [%s]\n", "hallo")
	msg.Errorf("an error message [%s]\n", "hello")
}

Documentation

Index

Constants

View Source
const (
	VERBOSE Level = -2
	DEBUG         = -1
	INFO          = 0
	WARNING       = 1
	ERROR         = 2
	FATAL         = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

type Logger

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

func New

func New(name string) *Logger

func NewLogger

func NewLogger(name string, lvl Level, w io.Writer) *Logger

func (*Logger) Debugf

func (msg *Logger) Debugf(format string, args ...interface{}) (int, error)

func (*Logger) Errorf

func (msg *Logger) Errorf(format string, args ...interface{}) (int, error)

func (*Logger) Infof

func (msg *Logger) Infof(format string, args ...interface{}) (int, error)

func (*Logger) Level

func (msg *Logger) Level() Level

func (*Logger) Name

func (msg *Logger) Name() string

func (*Logger) SetLevel

func (msg *Logger) SetLevel(lvl Level)

func (*Logger) Verbosef

func (msg *Logger) Verbosef(format string, args ...interface{}) (int, error)

func (*Logger) Warnf

func (msg *Logger) Warnf(format string, args ...interface{}) (int, error)

Jump to

Keyboard shortcuts

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