Documentation ¶
Overview ¶
Package logging provides some zap loggers for the use of a Grammes client.
By default the Grammes client uses a NilLogger for the logger. This can be changed by using the WithLogger function in the grammes package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicLogger ¶
type BasicLogger struct {
// contains filtered or unexported fields
}
BasicLogger is the default logger used by the Grammes client. This particular logger uses zap by default. The reasoning behind using a wrapper for logging is for flexibility when using the Grammes package. You are given the freedom to choose any kind of logger you wish as long as you create a wrapper that meets the criteria set by the Logger interface.
func NewBasicLogger ¶
func NewBasicLogger() *BasicLogger
NewBasicLogger returns a logger that is used for development, but only logs at the Error level.
func (*BasicLogger) Debug ¶
func (logger *BasicLogger) Debug(msg string, params map[string]interface{})
Debug logs at DebugLevel
func (*BasicLogger) Error ¶
func (logger *BasicLogger) Error(msg string, err error)
Error logs at ErrorLevel
func (*BasicLogger) Fatal ¶
func (logger *BasicLogger) Fatal(msg string, err error)
Fatal logs at FatalLevel
func (*BasicLogger) PrintQuery ¶
func (logger *BasicLogger) PrintQuery(q string)
PrintQuery will print the query at DebugLevel by default
type DebugLogger ¶
type DebugLogger struct {
// contains filtered or unexported fields
}
DebugLogger is the basic logger used for debugging an application. This will log everything in the debug level.
func NewDebugLogger ¶
func NewDebugLogger() *DebugLogger
NewDebugLogger returns a new debug logging object for the Grammes client to use.
func (*DebugLogger) Debug ¶
func (logger *DebugLogger) Debug(msg string, params map[string]interface{})
Debug logs at DebugLevel
func (*DebugLogger) Error ¶
func (logger *DebugLogger) Error(msg string, err error)
Error logs at ErrorLevel
func (*DebugLogger) Fatal ¶
func (logger *DebugLogger) Fatal(msg string, err error)
Fatal logs at FatalLevel
func (*DebugLogger) PrintQuery ¶
func (logger *DebugLogger) PrintQuery(q string)
PrintQuery will print the query at DebugLevel by default
type Logger ¶
type Logger interface { // This function specifically is meant // to log queries. This is in case you are // debugging an application and you wish to // print out the queries to Stdout or log // them somewhere else you may without // getting extra logs that you don't want. PrintQuery(msg string) // Debug is used when confirming when things // are doing their jobs such as when adding // vertex labels to the schema. Debug(msg string, fieldAndVals map[string]interface{}) // Error is used when there is a problem but // not a big enough problem to stop an app. // These problems are minor, but not major. Error(msg string, err error) // Fatal's purpose is to stop the application // because something really wrong happened. // A case of this being used is when trying to // put an odd number of properties in an AddVertex // function. Which would not create a proper query // for the gremlin server and should stop. Fatal(msg string, err error) }
Logger is a wrapper for any kind of logger you wish to use. This can be customized and changed within the Grammes client itself.
type NilLogger ¶
type NilLogger struct{}
NilLogger is the default logger used for the Grammes client. This logger will not print anything out.
func NewNilLogger ¶
func NewNilLogger() *NilLogger
NewNilLogger returns a nil logging object for the Grammes client to use.
type ProdLogger ¶
type ProdLogger struct {
// contains filtered or unexported fields
}
ProdLogger is the basic logger used for production level logging. This will log everything in the debug level.
func NewProdLogger ¶
func NewProdLogger() *ProdLogger
NewProdLogger returns a new debug logging object for the Grammes client to use.
func (*ProdLogger) Debug ¶
func (logger *ProdLogger) Debug(msg string, params map[string]interface{})
Debug logs at DebugLevel
func (*ProdLogger) Error ¶
func (logger *ProdLogger) Error(msg string, err error)
Error logs at ErrorLevel
func (*ProdLogger) Fatal ¶
func (logger *ProdLogger) Fatal(msg string, err error)
Fatal logs at FatalLevel
func (*ProdLogger) PrintQuery ¶
func (logger *ProdLogger) PrintQuery(q string)
PrintQuery will print the query at DebugLevel by default