Documentation ¶
Overview ¶
Package logging is part of the Tarmac suite of Host Callback packages. This package provides users with the ability to provide WASM functions with a host callback interface that provides logging capabilities.
import ( "github.com/madflojo/tarmac/pkg/callbacks" "github.com/madflojo/tarmac/pkg/callbacks/logging" ) func main() { // Create instance of logger to register for callback execution logger := logging.New(logging.Config{ Log: MyCustomLogger, }) // Create Callback router and register logger router := callbacks.New() router.RegisterCallback("logging", "Info", logger.Info) }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Log is an interface that can be provided by the instantiator. This interface allows users to specify their logging // functionality or incorporate an existing logger into the Tarmac Host Callback function. Log Log }
Config is provided to users to configure the Host Callback. All Tarmac Callbacks follow the same configuration format; each Config struct gives the specific Host Callback unique functionality.
type Log ¶
type Log interface { Info(args ...interface{}) Warn(args ...interface{}) Error(args ...interface{}) Debug(args ...interface{}) Trace(args ...interface{}) }
Log is an interface that can be provided and satisfied by the instantiator of the Logger struct. This interface allows users to specify their logging functionality or incorporate an existing logger into the Tarmac Host Callback functions.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger provides a Host Callback interface to interact with the underlying logging system. WASM functions can call this callback interface which will coordinate and execute the host-supplied logger instance.
func New ¶
New will create and return a new logger instance that users can register as a Tarmac Host Callback function. Users can provide a custom logger using the Configuration options supplied. By default, if there is no custom logger provided, the NoOpLog will be used.
func (*Logger) Debug ¶
Debug will take the incoming byte slice data and call the internal logger converting the data to a string.
func (*Logger) Error ¶
Error will take the incoming byte slice data and call the internal logger converting the data to a string.
func (*Logger) Info ¶
Info will take the incoming byte slice data and call the internal logger converting the data to a string.