log

package
v3.0.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 3 Imported by: 0

README

log Plugin

This example plugin provides a way to generate hashes of strings.

Installation

Add the plugin to the Plugins option in the Applications options:

    Plugins: map[string]application.Plugin{
        "log": log.NewPlugin(),
    },

Usage

You can then call the methods from the frontend:

    wails.Plugin("log","Debug","hello world")
Methods
  • Trace
  • Debug
  • Info
  • Warning
  • Error
  • Fatal
  • SetLevel

SetLevel takes an integer value from JS:

    wails.Plugin("log","SetLevel",1)

Levels are:

  • Trace: 1
  • Debug: 2
  • Info: 3
  • Warning: 4
  • Error: 5
  • Fatal: 6

Support

If you find a bug in this plugin, please raise a ticket here. Please do not contact the Wails team for support.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Logger is the logger to use. If not set, a default logger will be used.
	Logger *slog.Logger

	// LogLevel defines the log level of the logger.
	LogLevel slog.Level

	// Handles errors that occur when writing to the log
	ErrorHandler func(err error)
}

type Plugin

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

func NewPlugin

func NewPlugin() *Plugin

func NewPluginWithConfig

func NewPluginWithConfig(config *Config) *Plugin

func (*Plugin) CallableByJS

func (p *Plugin) CallableByJS() []string

CallableByJS returns a list of methods that can be called from the frontend

func (*Plugin) Debug

func (p *Plugin) Debug(message string, args ...any)

func (*Plugin) Error

func (p *Plugin) Error(message string, args ...any)

func (*Plugin) Info

func (p *Plugin) Info(message string, args ...any)

func (*Plugin) Init

func (p *Plugin) Init() error

func (*Plugin) InjectJS

func (p *Plugin) InjectJS() string

func (*Plugin) Name

func (p *Plugin) Name() string

Name returns the name of the plugin. You should use the go module format e.g. github.com/myuser/myplugin

func (*Plugin) SetLogLevel

func (p *Plugin) SetLogLevel(level slog.Level)

func (*Plugin) Shutdown

func (p *Plugin) Shutdown()

Shutdown is called when the app is shutting down You can use this to clean up any resources you have allocated

func (*Plugin) Warning

func (p *Plugin) Warning(message string, args ...any)

Jump to

Keyboard shortcuts

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