logmanager

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

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 Deps

type Deps struct {
	local.PluginLogDeps                  // inject
	LogRegistry         logging.Registry // inject
	HTTP                *rest.Plugin     // inject
}

Deps is here to group injected dependencies of plugin to not mix with 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
}

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