logconfig

package
v2.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DDBLogConfigCommit string = "MAESTRO_LOG_CONFIG_COMMIT_FLAG"

DDBLogConfigCommit the ID used to commit changes

View Source
const DDBLogConfigGroupID string = "log_group"

DDBLogConfigGroupID used in log writes

View Source
const DDBLogConfigName string = "MAESTRO_LOG_CONFIG_ID"

DDBLogConfigName name used in log writes

View Source
const (
	//LogPrefix is the added output is logging for this file
	LogPrefix = "LogManager: "
)

Variables

This section is empty.

Functions

func AddLogFilter

func AddLogFilter(filterConfig maestroSpecs.LogFilter) error

AddLogFilter is the function to update the live running filters

func ConfigChangeHandler

func ConfigChangeHandler(configgroup string, fieldchanged string, futvalue interface{}, curvalue interface{}, index int)

ConfigChangeHandler is the go routine which waits on configChangeRequestChan and when it receives a message which is ConfigChangeInfo object, it calls corresponding process functions(see below) based on config group.

func DeleteLogFilter

func DeleteLogFilter(filterConfig maestroSpecs.LogFilter) error

DeleteLogFilter is used to remove an existing log filter from the live running logs is maestro

func GetInstance

func GetInstance() *logManagerInstance

GetInstance get the global instance of the log manager

func GetLogLibVersion

func GetLogLibVersion() string

GetLogLibVersion get verson of log library

func InitLogManager

func InitLogManager(config *maestroConfig.YAMLMaestroConfig) (err error)

InitLogManager be called on startup. LogTarget will come from config file Storage should be started already.

Types

type ChangeHook

type ChangeHook struct {
}

ChangeHook is base struct for our class

func (ChangeHook) ChangesComplete

func (cfgHook ChangeHook) ChangesComplete(configgroup string) (acceptallchanges bool)

ChangesComplete is called when all changes for a specific configgroup tagname If ChangesComplete returns true, then all changes in that group will be assigned to the current struct

func (ChangeHook) ChangesStart

func (cfgHook ChangeHook) ChangesStart(configgroup string)

ChangesStart is called before reporting any changes via multiple calls to SawChange. It will only be called if there is at least one change to report

func (ChangeHook) SawChange

func (cfgHook ChangeHook) SawChange(configgroup string, fieldchanged string, futvalue interface{}, curvalue interface{}, index int) (acceptchange bool)

SawChange is called whenever a field changes. It will be called only once for each field which is changed. It will always be called after ChangesStart is called If SawChange return true, then the value of futvalue will replace the value of current value

type CommitConfigChangeHook

type CommitConfigChangeHook struct {
}

CommitConfigChangeHook is the handler to commit and apply changes

func (CommitConfigChangeHook) ChangesComplete

func (cfgHook CommitConfigChangeHook) ChangesComplete(configgroup string) (acceptallchanges bool)

ChangesComplete is called when all changes for a specific configgroup tagname If ChangesComplete returns true, then all changes in that group will be assigned to the current struct

func (CommitConfigChangeHook) ChangesStart

func (cfgHook CommitConfigChangeHook) ChangesStart(configgroup string)

ChangesStart is called before reporting any changes via multiple calls to SawChange. It will only be called if there is at least one change to report

func (CommitConfigChangeHook) SawChange

func (cfgHook CommitConfigChangeHook) SawChange(configgroup string, fieldchanged string, futvalue interface{}, curvalue interface{}, index int) (acceptchange bool)

SawChange is called whenever a field changes. It will be called only once for each field which is changed. It will always be called after ChangesStart is called If SawChange return true, then the value of futvalue will replace the value of current value

type ConfigCommit

type ConfigCommit struct {
	// Set this flag to true for the changes to commit, if this flag is false
	// the changes to configuration on these structs will not acted upon
	// by network manager. For exmaple, this flag will be initially false
	// so that user can change the config object in DeviceDB and verify that the
	// intented changes are captured correctly. Once verified set this flag to true
	// so that the changes will be applied by maestro. Once maestro complete the
	// changes the flag will be set to false by maestro.
	ConfigCommitFlag bool `yaml:"config_commit" json:"config_commit" log_group:"config_commit"`
	//Datetime of last update
	LastUpdateTimestamp string `yaml:"config_commit" json:"last_commit_timestamp" log_group:"config_commit"`
	//Total number of updates from boot
	TotalCommitCountFromBoot int `yaml:"config_commit" json:"total_commit_count_from_boot" log_group:"config_commit"`
}

ConfigCommit is the structure to hold commit change applications

type LogData

type LogData struct {
	// the settings as they should be
	StoredLogconfig []maestroSpecs.LogTarget
	// the settings as they are right now
	RunningLogconfig []maestroSpecs.LogTarget

	// last time the log config was changed
	// ms since Unix epoch
	LastUpdated int64
	// contains filtered or unexported fields
}

LogData is the internal wrapper, used to store log settings

func (*LogData) MarshalJSON

func (logdata *LogData) MarshalJSON() ([]byte, error)

MarshalJSON is a helper function to load json data

Jump to

Keyboard shortcuts

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