logger

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

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

Go to latest
Published: Nov 15, 2015 License: MIT Imports: 6 Imported by: 0

README

Logger

A Go logging library able to log in MongoDB, standard outputs and files

Build Status Coverage Status License MIT

Warning : this project is in early alpha

Installation

go get github.com/valere91/logger

The library has one dependency : mgo.v2

go get gopkg.in/mgo.v2

Basic Usage

To standard outputs
StdoutLogger.Log("Something to log")
StderrLogger.Log("Something to log")
To file
//First initialise the log file 
ConfigureFileLogger("./output.log")

//You can use it after
FileLogger.Log("Something to log")
To MongoDB
//First initialise the MongoDB logger 
ConfigureMongoLogger("localhost","database","log_collection")

//You can use it after
MongoDBLogger.Log("Something to log")

Documentation

See docs on Wiki

License

MIT License

Copyright (c) 2015 Valère Plantevin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FileLogger *streamLogger = nil
View Source
var MongoDBLogger *mongoLogger = nil
View Source
var StderrLogger *streamLogger = newStreamLogger(os.Stderr)
View Source
var StdoutLogger *streamLogger = newStreamLogger(os.Stdout)

Functions

func ConfigureFileLogger

func ConfigureFileLogger(path string) (logger *streamLogger, err error)

func ConfigureMongoLogger

func ConfigureMongoLogger(mongoURL string, database string, collection string) (logger *mongoLogger, err error)

Types

type Logger

type Logger interface {
	Debug(args ...interface{})
	DebugF(layout string, args ...interface{})
	Log(args ...interface{})
	LogF(layout string, args ...interface{})
	Error(args ...interface{})
	ErrorF(layout string, args ...interface{})
	Fatal(args ...interface{})
	FatalF(layout string, args ...interface{})
}

Jump to

Keyboard shortcuts

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