Documentation ¶
Overview ¶
Package stalog provides application logger for Cloud Logging.
Index ¶
- Variables
- func RequestLogging(config *Config) func(http.Handler) http.Handler
- func RequestLoggingWithEcho(config *Config) echo.MiddlewareFunc
- func RequestLoggingWithFunc(config *Config, w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
- type AdditionalData
- type Config
- type ContextLogger
- func (l *ContextLogger) Alert(args ...interface{})
- func (l *ContextLogger) Alertf(format string, args ...interface{})
- func (l *ContextLogger) Alertln(args ...interface{})
- func (l *ContextLogger) Critical(args ...interface{})
- func (l *ContextLogger) Criticalf(format string, args ...interface{})
- func (l *ContextLogger) Criticalln(args ...interface{})
- func (l *ContextLogger) Debug(args ...interface{})
- func (l *ContextLogger) Debugf(format string, args ...interface{})
- func (l *ContextLogger) Debugln(args ...interface{})
- func (l *ContextLogger) Default(args ...interface{})
- func (l *ContextLogger) Defaultf(format string, args ...interface{})
- func (l *ContextLogger) Defaultln(args ...interface{})
- func (l *ContextLogger) Emergency(args ...interface{})
- func (l *ContextLogger) Emergencyf(format string, args ...interface{})
- func (l *ContextLogger) Emergencyln(args ...interface{})
- func (l *ContextLogger) Error(args ...interface{})
- func (l *ContextLogger) Errorf(format string, args ...interface{})
- func (l *ContextLogger) Errorln(args ...interface{})
- func (l *ContextLogger) Info(args ...interface{})
- func (l *ContextLogger) Infof(format string, args ...interface{})
- func (l *ContextLogger) Infoln(args ...interface{})
- func (l *ContextLogger) Notice(args ...interface{})
- func (l *ContextLogger) Noticef(format string, args ...interface{})
- func (l *ContextLogger) Noticeln(args ...interface{})
- func (l *ContextLogger) Warn(args ...interface{})
- func (l *ContextLogger) Warnf(format string, args ...interface{})
- func (l *ContextLogger) Warning(args ...interface{})
- func (l *ContextLogger) Warningf(format string, args ...interface{})
- func (l *ContextLogger) Warningln(args ...interface{})
- func (l *ContextLogger) Warnln(args ...interface{})
- type HTTPRequest
- type HTTPRequestLog
- type Reserve
- type Severity
- type SourceLocation
Constants ¶
This section is empty.
Variables ¶
var ContextLoggerKey = &contextKey{}
Functions ¶
func RequestLogging ¶
RequestLogging creates the middleware which logs a request log and creates a request-context logger
func RequestLoggingWithEcho ¶
func RequestLoggingWithEcho(config *Config) echo.MiddlewareFunc
RequestLoggingWithEcho creates the middleware which logs a request log and creates a request-context logger
func RequestLoggingWithFunc ¶
func RequestLoggingWithFunc(config *Config, w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
RequestLoggingWithFunc for WebHook
Types ¶
type AdditionalData ¶
type AdditionalData map[string]interface{}
type Config ¶
type Config struct { ProjectId string // Output for request log RequestLogOut io.Writer // Output for context log (application log) ContextLogOut io.Writer Severity Severity AdditionalData AdditionalData // nest level for runtime.Caller (default: 2) Skip int }
Config is the configuration for `RequestLogging` middleware.
type ContextLogger ¶
type ContextLogger struct { Trace string Severity Severity AdditionalData AdditionalData Skip int // contains filtered or unexported fields }
ContextLogger is the logger which is combined with the request
func RequestContextLogger ¶
func RequestContextLogger(r *http.Request) *ContextLogger
RequestContextLogger gets request-context logger for the request. You must use `RequestLogging` middleware in advance for this function to work.
func (*ContextLogger) Alert ¶
func (l *ContextLogger) Alert(args ...interface{})
Alert logs a message at ALERT severity
func (*ContextLogger) Alertf ¶
func (l *ContextLogger) Alertf(format string, args ...interface{})
Alertf logs a message at ALERT severity
func (*ContextLogger) Alertln ¶
func (l *ContextLogger) Alertln(args ...interface{})
Alertln logs a message at ALERT severity
func (*ContextLogger) Critical ¶
func (l *ContextLogger) Critical(args ...interface{})
Critical logs a message at CRITICAL severity
func (*ContextLogger) Criticalf ¶
func (l *ContextLogger) Criticalf(format string, args ...interface{})
Criticalf logs a message at CRITICAL severity
func (*ContextLogger) Criticalln ¶
func (l *ContextLogger) Criticalln(args ...interface{})
Criticalln logs a message at CRITICAL severity
func (*ContextLogger) Debug ¶
func (l *ContextLogger) Debug(args ...interface{})
Debug logs a message at DEBUG severity
func (*ContextLogger) Debugf ¶
func (l *ContextLogger) Debugf(format string, args ...interface{})
Debugf logs a message at DEBUG severity
func (*ContextLogger) Debugln ¶
func (l *ContextLogger) Debugln(args ...interface{})
Debugln logs a message at DEBUG severity
func (*ContextLogger) Default ¶
func (l *ContextLogger) Default(args ...interface{})
Default logs a message at DEFAULT severity
func (*ContextLogger) Defaultf ¶
func (l *ContextLogger) Defaultf(format string, args ...interface{})
Defaultf logs a message at DEFAULT severity
func (*ContextLogger) Defaultln ¶
func (l *ContextLogger) Defaultln(args ...interface{})
Defaultln logs a message at DEFAULT severity
func (*ContextLogger) Emergency ¶
func (l *ContextLogger) Emergency(args ...interface{})
Emergency logs a message at EMERGENCY severity
func (*ContextLogger) Emergencyf ¶
func (l *ContextLogger) Emergencyf(format string, args ...interface{})
Emergencyf logs a message at EMERGENCY severity
func (*ContextLogger) Emergencyln ¶
func (l *ContextLogger) Emergencyln(args ...interface{})
Emergencyln logs a message at EMERGENCY severity
func (*ContextLogger) Error ¶
func (l *ContextLogger) Error(args ...interface{})
Error logs a message at ERROR severity
func (*ContextLogger) Errorf ¶
func (l *ContextLogger) Errorf(format string, args ...interface{})
Errorf logs a message at ERROR severity
func (*ContextLogger) Errorln ¶
func (l *ContextLogger) Errorln(args ...interface{})
Errorln logs a message at ERROR severity
func (*ContextLogger) Info ¶
func (l *ContextLogger) Info(args ...interface{})
Info logs a message at INFO severity
func (*ContextLogger) Infof ¶
func (l *ContextLogger) Infof(format string, args ...interface{})
Infof logs a message at INFO severity
func (*ContextLogger) Infoln ¶
func (l *ContextLogger) Infoln(args ...interface{})
Infoln logs a message at INFO severity
func (*ContextLogger) Notice ¶
func (l *ContextLogger) Notice(args ...interface{})
Notice logs a message at NOTICE severity
func (*ContextLogger) Noticef ¶
func (l *ContextLogger) Noticef(format string, args ...interface{})
Noticef logs a message at NOTICE severity
func (*ContextLogger) Noticeln ¶
func (l *ContextLogger) Noticeln(args ...interface{})
Noticeln logs a message at NOTICE severity
func (*ContextLogger) Warn ¶
func (l *ContextLogger) Warn(args ...interface{})
Warn logs a message at WARNING severity
func (*ContextLogger) Warnf ¶
func (l *ContextLogger) Warnf(format string, args ...interface{})
Warnf logs a message at WARNING severity
func (*ContextLogger) Warning ¶
func (l *ContextLogger) Warning(args ...interface{})
Warning logs a message at WARNING severity
func (*ContextLogger) Warningf ¶
func (l *ContextLogger) Warningf(format string, args ...interface{})
Warningf logs a message at WARNING severity
func (*ContextLogger) Warningln ¶
func (l *ContextLogger) Warningln(args ...interface{})
Warningln logs a message at WARNING severity
func (*ContextLogger) Warnln ¶
func (l *ContextLogger) Warnln(args ...interface{})
Warnln logs a message at WARNING severity
type HTTPRequest ¶
type HTTPRequest struct { RequestMethod string `json:"requestMethod"` RequestUrl string `json:"requestUrl"` RequestSize string `json:"requestSize"` Status int `json:"status"` ResponseSize string `json:"responseSize"` UserAgent string `json:"userAgent"` RemoteIP string `json:"remoteIp"` ServerIP string `json:"serverIp"` Referer string `json:"referer"` Latency string `json:"latency"` CacheLookup bool `json:"cacheLookup"` CacheHit bool `json:"cacheHit"` CacheValidatedWithOriginServer bool `json:"cacheValidatedWithOriginServer"` Protocol string `json:"protocol"` }
type HTTPRequestLog ¶
type HTTPRequestLog struct { Time string `json:"time"` Trace string `json:"logging.googleapis.com/trace"` Severity string `json:"severity"` HTTPRequest HTTPRequest `json:"httpRequest"` AdditionalData AdditionalData `json:"data,omitempty"` }
type Reserve ¶
type Reserve struct {
// contains filtered or unexported fields
}
func (*Reserve) LastHandling ¶
func (rv *Reserve) LastHandling(wrw *wrappedResponseWriter)
type Severity ¶
type Severity int
Severity is the level of log. More details: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#LogSeverity