logging

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContentTypeJSON is a Content-Type header for json formatted logs
	ContentTypeJSON = "application/json"
	// ContentTypeGzipJSON is a Content-Type header for gzipped json formatted logs
	ContentTypeGzipJSON = "application/gzip"
	// HeaderLicenseKey is for use with new relic license key
	HeaderLicenseKey = "X-License-Key"
	// HeaderInsertKey is for use with new relic insert api key
	HeaderInsertKey = "Api-Key"
	// USLogsEndpoint is the new relic logs endpoint for US users
	USLogsEndpoint = "https://log-api.newrelic.com/log/v1"
	// EULogsEndpoint is the new relig logs endpoint for EU users
	EULogsEndpoint = "https://log-api.eu.newrelic.com/log/v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApacheLogRecord

type ApacheLogRecord struct {
	*LogRecord

	IP                    string
	Time                  time.Time
	Method, URI, Protocol string
	ElapsedTime           time.Duration
}

ApacheLogRecord is a complex log format to match the apache request logs

func (*ApacheLogRecord) Log

func (r *ApacheLogRecord) Log(out io.Writer)

type ConnectLogRecord

type ConnectLogRecord struct {
	IP                    string
	Time                  time.Time
	Method, URI, Protocol string
}

ConnectLogRecord is a simpler log format to record server connections

func (*ConnectLogRecord) Log

func (c *ConnectLogRecord) Log(out io.Writer)

type LogRecord added in v0.0.5

type LogRecord struct {
	http.ResponseWriter
	ResponseBytes int64
	Status        int
}

func (*LogRecord) Write added in v0.0.5

func (r *LogRecord) Write(p []byte) (int, error)

func (*LogRecord) WriteHeader added in v0.0.5

func (r *LogRecord) WriteHeader(status int)

type NRLogProcessor added in v0.0.5

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

NRLogProcessor sends logs to new relic log api. Impliments io.Writer

func NewEUNRLogProcessorWithInsertKey added in v0.0.5

func NewEUNRLogProcessorWithInsertKey(key string) NRLogProcessor

NewEUNRLogProcessorWithInsertKey returns NRLogProcessor to send logs to new relic logs api

func NewEUNRLogProcessorWithLicenseKey added in v0.0.5

func NewEUNRLogProcessorWithLicenseKey(key string) NRLogProcessor

NewEUNRLogProcessorWithLicenseKey returns NRLogProcessor to send logs to new relic logs api

func (NRLogProcessor) Write added in v0.0.5

func (nr NRLogProcessor) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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