logentries

package module
Version: v0.0.0-...-6ed02b4 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2016 License: MIT Imports: 4 Imported by: 1

README

Logentries logger for Go

GOPHER

MIT GODOC

Drop in solution for integrating logentries into your app. Implements the io.Writer interface so it will easily forward anything logged from the log package will show up in logentries.

Uses channels and buffered goroutines so it's non blocking for most use.

###Example

package main

import (
	"io"
	"log"
	"os"

	"github.com/DDRBoxman/go-logentries"
)

func main() {
	logentriesWriter := logentries.New("XXXX-XXXXXXX-XXXXX-XXX") //Token here
	defer logentriesWriter.Close()

	multiWriter := io.MultiWriter(os.Stderr, logentriesWriter)
	
	log.SetOutput(multiWriter)

	log.Print("test")
	log.Print("test2")
	log.Print("test3")
}

Documentation

Overview

Package logentries is a drop in solution for integrating logentries into your app. Implements the **io.Writer** interface so it will easily forward anything logged from the **log** package will show up in logentries.

Uses channels and buffered goroutines so it's non blocking for most use.

Author: Colin Edwards

Example

logentriesWriter := logentries.New("XXXX-XXXXXXX-XXXXX-XXX") //Token here
defer logentriesWriter.Close()

multiWriter := io.MultiWriter(os.Stderr, logentriesWriter)

log.SetOutput(multiWriter)

log.Print("test")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logentries

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

func New

func New(token string) (l *Logentries)

Create a new logentries instance

func (*Logentries) Close

func (l *Logentries) Close()

Clean up the logger and send any remaining messages

func (*Logentries) Port

func (l *Logentries) Port(port int)

Set the port to send data to Logentries on

Valid ports: 80, 514, 10000, 20000

20000 automatically enables SSL

func (*Logentries) UseSSL

func (l *Logentries) UseSSL(useSSL bool)

Use SSL when sending data to Logentries

Sets port to 20000

func (*Logentries) Write

func (l *Logentries) Write(p []byte) (n int, err error)

Implement the io.Writer interface

type ServiceNameLogger

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

func NewServiceNameLogger

func NewServiceNameLogger(serviceName string, writer io.Writer) (l *ServiceNameLogger)

func (*ServiceNameLogger) Write

func (l *ServiceNameLogger) Write(p []byte) (n int, err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL