Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditResponseWriter ¶
type AuditResponseWriter struct { http.ResponseWriter URL url.URL // The request URL Identity kes.Identity // The request X.509 identity RequestHeader http.Header // The request headers Time time.Time // The time when we receive the request Logger *log.Logger // contains filtered or unexported fields }
AuditResponseWriter is an http.ResponseWriter implementation that logs (parts of) the request and response before sending the status code back to the client.
func (*AuditResponseWriter) Flush ¶
func (w *AuditResponseWriter) Flush()
func (*AuditResponseWriter) Header ¶
func (w *AuditResponseWriter) Header() http.Header
func (*AuditResponseWriter) WriteHeader ¶
func (w *AuditResponseWriter) WriteHeader(statusCode int)
type FlushWriter ¶
A FlushWriter wraps an io.Writer and performs a flush operation after every write call if the wrapped io.Writer implements http.Flusher.
A FlushWriter is useful when (even small) data should reach the receiver as soon as possible. For example, in case of audit logging.
func NewFlushWriter ¶
func NewFlushWriter(w io.Writer) FlushWriter
NewFlushWriter returns a new FlushWriter that wraps w and flushes everything written to it as soon as possible if w implements http.Flusher.
func (FlushWriter) Flush ¶ added in v0.7.0
func (w FlushWriter) Flush()
type JSONWriter ¶ added in v0.7.0
JSONWriter wraps an io.Writer and converts everything written to it into a JSON object object.
In particular, it converts the content passed to JSONWriter.Write into the following object:
{ "message":"<content>" }
Note that a JSONWriter does not try to concatinate multiple Write calls into the same JSON object. The main purpose of a JSONWriter is to convert the output of a log.Logger into JSON.
func NewJSONWriter ¶ added in v0.7.0
func NewJSONWriter(w io.Writer) JSONWriter
NewJSONWriter returns a new JSONWriter that wraps w and converts everything written to it into the following JSON object:
{ "message":"<content" }
func (JSONWriter) Flush ¶ added in v0.7.0
func (w JSONWriter) Flush()
func (JSONWriter) WriteString ¶ added in v0.7.0
func (w JSONWriter) WriteString(s string) (n int, err error)
type SystemLog ¶
type SystemLog struct {
// contains filtered or unexported fields
}
SystemLog groups a set of logging targets. It holds a reference to a *log.Logger which gets updated whenever a log target gets added or removed. Since this can happen concurrently, it is not recommended to set the log output of SystemLog.Logger() manually. Instead, modify the *log.Logger output through the SystemLog API.
func NewLogger ¶
NewLogger creates a new SystemLog. The out variable sets the destination to which log data will be written. The prefix appears at the beginning of each generated log line. The flag argument defines the logging properties.
func (*SystemLog) Log ¶
Log returns the actual logger that writes everything to the currently specified output destination.
func (*SystemLog) RemoveOutput ¶
RemoveOutput removes the output destination from the logger, if it exists.