logging

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 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

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

func (*LogRecord) Write

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

func (*LogRecord) WriteHeader

func (r *LogRecord) WriteHeader(status int)

type NRLogProcessor

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

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

func NewEUNRLogProcessorWithInsertKey

func NewEUNRLogProcessorWithInsertKey(key string) NRLogProcessor

NewEUNRLogProcessorWithInsertKey returns NRLogProcessor to send logs to new relic logs api

func NewEUNRLogProcessorWithLicenseKey

func NewEUNRLogProcessorWithLicenseKey(key string) NRLogProcessor

NewEUNRLogProcessorWithLicenseKey returns NRLogProcessor to send logs to new relic logs api

func (NRLogProcessor) Write

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