Documentation ¶
Overview ¶
Package logmanager implements the log manager that allows users to set log levels at run-time via a REST API.
Index ¶
Constants ¶
const ( HookSysLog = "syslog" HookLogStash = "logstash" HookFluent = "fluent" )
list of supported hook services to send errors to remote syslog server
Variables ¶
var DefaultPlugin = *NewPlugin()
DefaultPlugin is a default instance of Plugin.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v1.5.0
type Config struct { DefaultLevel string `json:"default-level"` Loggers []LoggerConfig `json:"loggers"` Hooks map[string]HookConfig `json:"hooks"` }
Config is a binding that supports to define default log levels for multiple loggers
type Deps ¶
type Deps struct { infra.PluginDeps ServiceLabel servicelabel.ReaderAPI LogRegistry logging.Registry HTTP rest.HTTPHandlers }
Deps groups dependencies injected into the plugin so that they are logically separated from other plugin fields.
type HookConfig ¶ added in v1.5.0
HookConfig contains configuration of hook services
type LoggerConfig ¶ added in v1.5.0
LoggerConfig is configuration of a particular logger. Currently we support only logger level.
type LoggerData ¶
LoggerData encapsulates parameters of a logger represented as strings.
type Option ¶ added in v1.5.0
type Option func(*Plugin)
Option is a function that can be used in NewPlugin to customize Plugin.
func UseConf ¶ added in v1.5.0
UseConf returns Option which injects a particular configuration.
type Plugin ¶
Plugin allows to manage log levels of the loggers.
func NewPlugin ¶ added in v1.5.0
NewPlugin creates a new Plugin with the provided Options.
func (*Plugin) AfterInit ¶
AfterInit is called at plugin initialization. It register the following handlers:
- List all registered loggers: > curl -X GET http://localhost:<port>/log/list
- Set log level for a registered logger: > curl -X PUT http://localhost:<port>/log/<logger-name>/<log-level>