README
¶
Log Manager
Log manager plugin allows to view and modify log levels of loggers using REST API.
API
-
List all registered loggers:
curl -X GET http://<host>:<port>/log/list
-
Set log level for a registered logger:
curl -X PUT http://<host>:<port>/log/<logger-name>/<log-level>
<log-level>
is one ofdebug
,info
,warning
,error
,fatal
,panic
<host>
and <port>
are determined by configuration of rest.Plugin.
Config file
-
Logger config file is composed of two parts: the default level applied for all plugins, and a map where every logger can have its own log level defined. See config file example to learn how to define it.
Note: initial log level can be set using environmental variable
INITIAL_LOGLVL
. The variable replaces default-level from configuration file. However, loggers (partial definition) replace default value set by environmental variable for specific loggers defined.
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.
type Plugin ¶
Plugin allows to manage log levels of the loggers.
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>