Documentation ¶
Index ¶
- Variables
- func Access(r *http.Request, start time.Time, statusCode int)
- func AccessError(r *http.Request, start time.Time, err error)
- func Application(h http.Header) *logrus.Entry
- func Cacheinfo(url string, hit bool)
- func Call(r *http.Request, resp *http.Response, start time.Time, err error)
- func EnsureCorrelationId(r *http.Request) string
- func GetCorrelationId(h http.Header) string
- func GetUserCorrelationId(h http.Header) string
- func LifecycleStart(appName string, args interface{})
- func LifecycleStop(appName string, signal os.Signal, err error)
- func ServerClosed(appName string)
- func Set(level string, textLogging bool) error
- type LogMiddleware
- type LogstashFormatter
Constants ¶
This section is empty.
Variables ¶
var AccessLogCookiesBlacklist = []string{}
The of cookies which should not be logged
var CorrelationIdHeader = "X-Correlation-Id"
var LifecycleEnvVars = []string{"BUILD_NUMBER", "BUILD_HASH", "BUILD_DATE"}
var Logger *logrus.Logger
var UserCorrelationCookie = ""
Functions ¶
func AccessError ¶
AccessError logs an error while accessing
func Application ¶
Return a log entry for application logs, prefilled with the correlation ids out of the supplied request.
func EnsureCorrelationId ¶
EnsureCorrelationId returns the correlation from of the request. If the request does not have a correlation id, one will be generated and set to the request.
func GetCorrelationId ¶
GetCorrelationId returns the correlation from of the request.
func GetUserCorrelationId ¶
GetCorrelationId returns the users correlation id of the headers.
func LifecycleStart ¶
func LifecycleStart(appName string, args interface{})
LifecycleStart logs the start of an application with the configuration struct or map as paramter.
func LifecycleStop ¶
LifecycleStop logs the stop of an application
Types ¶
type LogMiddleware ¶
func NewLogMiddleware ¶
func NewLogMiddleware(next http.Handler) *LogMiddleware
func (*LogMiddleware) ServeHTTP ¶
func (mw *LogMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
type LogstashFormatter ¶
type LogstashFormatter struct { Type string // if not empty use for logstash type field. // TimestampFormat sets the format used for timestamps. TimestampFormat string }
Formatter generates json in logstash format. Logstash site: http://logstash.net/
func (*LogstashFormatter) Format ¶
func (f *LogstashFormatter) Format(entry *logrus.Entry) ([]byte, error)