le_go: github.com/bsphere/le_go Index | Examples | Files

package le_go

import "github.com/bsphere/le_go"

Package le_go provides a Golang client library for logging to logentries.com over a TCP connection.

it uses an access token for sending log events.

Index

Examples

Package Files

le.go

type Logger Uses

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

Logger represents a Logentries logger, it holds the open TCP connection, access token, prefix and flags.

all Logger operations are thread safe and blocking, log operations can be invoked in a non-blocking way by calling them from a goroutine.

Code:

le, err := Connect("XXXX-XXXX-XXXX-XXXX") // replace with token
if err != nil {
    panic(err)
}

defer le.Close()

le.Println("another test message")

Code:

le, err := Connect("XXXX-XXXX-XXXX-XXXX") // replace with token
if err != nil {
    panic(err)
}

defer le.Close()

fmt.Fprintln(le, "another test message")

func Connect Uses

func Connect(token string) (*Logger, error)

Connect creates a new Logger instance and opens a TCP connection to logentries.com, The token can be generated at logentries.com by adding a new log, choosing manual configuration and token based TCP connection.

func (*Logger) Close Uses

func (logger *Logger) Close() error

Close closes the TCP connection to logentries.com

func (*Logger) Fatal Uses

func (logger *Logger) Fatal(v ...interface{})

Fatal is same as Print() but calls to os.Exit(1)

func (*Logger) Fatalf Uses

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

Fatalf is same as Printf() but calls to os.Exit(1)

func (*Logger) Fatalln Uses

func (logger *Logger) Fatalln(v ...interface{})

Fatalln is same as Println() but calls to os.Exit(1)

func (*Logger) Flags Uses

func (logger *Logger) Flags() int

Flags returns the logger flags

func (*Logger) Output Uses

func (logger *Logger) Output(calldepth int, s string) error

Output does the actual writing to the TCP connection

func (*Logger) Panic Uses

func (logger *Logger) Panic(v ...interface{})

Panic is same as Print() but calls to panic

func (*Logger) Panicf Uses

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

Panicf is same as Printf() but calls to panic

func (*Logger) Panicln Uses

func (logger *Logger) Panicln(v ...interface{})

Panicln is same as Println() but calls to panic

func (*Logger) Prefix Uses

func (logger *Logger) Prefix() string

Prefix returns the logger prefix

func (*Logger) Print Uses

func (logger *Logger) Print(v ...interface{})

Print logs a message

func (*Logger) Printf Uses

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

Printf logs a formatted message

func (*Logger) Println Uses

func (logger *Logger) Println(v ...interface{})

Println logs a message with a linebreak

func (*Logger) SetFlags Uses

func (logger *Logger) SetFlags(flag int)

SetFlags sets the logger flags

func (*Logger) SetPrefix Uses

func (logger *Logger) SetPrefix(prefix string)

SetPrefix sets the logger prefix

func (*Logger) Write Uses

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

Write writes a bytes array to the Logentries TCP connection, it adds the access token and prefix and also replaces line breaks with the unicode \u2028 character

Package le_go imports 7 packages (graph) and is imported by 58 packages. Updated 2017-10-27. Refresh now. Tools for package owners.