cheshire

package
v0.0.0-...-ac3bb21 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2013 License: MIT Imports: 2 Imported by: 0

README

cheshire-log

##Overview

A simple log replacement.

This logger allows you to easily subscribe to log events.

To use simply change the log import path from to

    import ("github.com/trendrr/goshire/log")

    //then use as you would the regular log
    log.Println("Heres a log message")

To subscribe to log events:

    log.Listen(eventChannel)

To unsubscribe to log events:

    log.Unlisten(eventChannel)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Emit

func Emit(eventType, eventMessage string)

func Fatal

func Fatal(v ...interface{})

func Fatalf

func Fatalf(format string, v ...interface{})

func Fatalln

func Fatalln(v ...interface{})

func Flags

func Flags() int

func Listen

func Listen(eventchan chan LoggerEvent)

func Panic

func Panic(v ...interface{})

func Panicf

func Panicf(format string, v ...interface{})

func Panicln

func Panicln(v ...interface{})

func Prefix

func Prefix() string

func Print

func Print(v ...interface{})

func Printf

func Printf(format string, v ...interface{})

func Println

func Println(v ...interface{})

func SetFlags

func SetFlags(flag int)

func SetPrefix

func SetPrefix(prefix string)

func Unlisten

func Unlisten(eventchan chan LoggerEvent)

Types

type Logger

type Logger struct {
	golog.Logger

	//The event type that will show up when using the log standard calls (default to "log")
	Type string
	// contains filtered or unexported fields
}

This is a special logger. It has the same methods as the standard golang Logger class, but allows you to register for updates. This allows us to expose the logging events easily via an api call.

func NewLogger

func NewLogger() *Logger

Creates a new Logger object

func (*Logger) Emit

func (this *Logger) Emit(eventType, eventMessage string)

Emits this message to all the listening channels

func (*Logger) Listen

func (this *Logger) Listen(eventchan chan LoggerEvent)

func (*Logger) Unlisten

func (this *Logger) Unlisten(eventchan chan LoggerEvent)

func (*Logger) Write

func (this *Logger) Write(p []byte) (n int, err error)

Conform to Writer interface. will write events as "log", string This allows us to use this in Logger object. Will Effectively never throw an error

type LoggerEvent

type LoggerEvent struct {
	Type    string
	Message string
}

Jump to

Keyboard shortcuts

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