logmanager

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: Apache-2.0 Imports: 8 Imported by: 36

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 of debug,info,warning,error,fatal,panic

<host> and <port> are determined by configuration of rest.Plugin.

Documentation

Overview

Package logmanager implements the log manager that allows users to set log levels at run-time via a REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf added in v1.0.4

type Conf struct {
	DefaultLevel string
	Loggers      []ConfLogger
}

Conf is a binding that supports to define default log levels for multiple loggers

func NewConf added in v1.0.4

func NewConf() *Conf

NewConf creates default configuration with InfoLevel & empty loggers. Suitable also for usage in flavor to programmatically specify default behavior.

type ConfLogger added in v1.0.4

type ConfLogger struct {
	Name  string
	Level string //debug, info, warning, error, fatal, panic
}

ConfLogger is configuration of a particular logger. Currently we support only logger level.

type Deps

type Deps struct {
	Log                 logging.PluginLogger //inject
	PluginName          core.PluginName      //inject
	config.PluginConfig                      //inject

	LogRegistry logging.Registry  // inject
	HTTP        rest.HTTPHandlers // inject
}

Deps groups dependencies injected into the plugin so that they are logically separated from other plugin fields.

type LoggerData

type LoggerData struct {
	Logger string `json:"logger"`
	Level  string `json:"level"`
}

LoggerData encapsulates parameters of a logger represented as strings.

type Plugin

type Plugin struct {
	Deps
	*Conf
}

Plugin allows to manage log levels of the loggers using HTTP.

func (*Plugin) AfterInit

func (lm *Plugin) AfterInit() error

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>

func (*Plugin) Close

func (lm *Plugin) Close() error

Close is called at plugin cleanup phase.

func (*Plugin) Init

func (lm *Plugin) Init() error

Init does nothing

Jump to

Keyboard shortcuts

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