objlog

package
v3.8.31 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: BSD-2-Clause Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONObjLogger

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

func (*JSONObjLogger) Close

func (jol *JSONObjLogger) Close() error

Close will flush the file output and close the file handle. The caller should not operate on the JSON logger after calling Close. Close will return an error if the ojbect is already closed or has not be initalized.

func (*JSONObjLogger) Log

func (jol *JSONObjLogger) Log(id, method string, obj interface{}) error

Log records a request path, method, and the objects sent and received. The output JSON will be encoded with tab indentation and a newline betwen objects.

type NilObjLogger

type NilObjLogger struct {
}

NillObjLogger is an empty implementation of the ObjLog interface for use when no logging is desired.

func (*NilObjLogger) Close

func (nol *NilObjLogger) Close() error

Close implements the Close method on the interface, NilObjLogger does nothing.

func (*NilObjLogger) Log

func (nol *NilObjLogger) Log(id, method string, obj interface{}) error

Log implements the Log method on the interface, NilObjLogger does nothing.

type ObjLog

type ObjLog interface {
	Close() error
	Log(id, method string, obj interface{}) error
}

ObjLog is the interfaced used by the command line client so that all API requests and responses can be logged during normal operation. This interface is useful for debugging, development, and tracing the Gravwell request API.

func NewJSONLogger

func NewJSONLogger(path string) (ObjLog, error)

NewJSONLogger initializes an ObjLog compatible interface for logging request and response objects. The JSON logger will open a file in append mode and log requests, including their request and response objects. The output will be compact JSON encoded objects.

func NewNilLogger

func NewNilLogger() (ObjLog, error)

NewNilLogger generates an empty/do nothing logger that implements the ObjLog interface.

Jump to

Keyboard shortcuts

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