Exemplo n.º 1
0
func (instance *Config) init() {
	(*instance).Logger = logger.NewConfig()
	(*instance).Command = []values.String{}
	(*instance).PreCommands = [][]values.String{}
	(*instance).PostCommands = [][]values.String{}
	(*instance).Type = AutoStart
	(*instance).CronExpression = NewCronExpression()
	(*instance).StartDelayInSeconds = values.NonNegativeInteger(0)
	(*instance).RestartDelayInSeconds = values.NonNegativeInteger(5)
	(*instance).SuccessExitCodes = values.ExitCodes{values.ExitCode(0)}
	(*instance).StopSignal = defaultStopSignal()
	(*instance).StopSignalTarget = values.ProcessGroup
	(*instance).StopCommand = []values.String{}
	(*instance).StopWaitInSeconds = values.NonNegativeInteger(30)
	(*instance).User = values.String("")
	(*instance).Environment = Environments{}
	(*instance).Directory = values.String("")
	(*instance).AutoRestart = values.OnFailures
	(*instance).InheritEnvironment = values.Boolean(true)
	(*instance).Access = access.NewNoneConfig()
}
Exemplo n.º 2
0
package logger

import (
	"github.com/echocat/caretakerd/values"
)

var defaults = map[string]interface{}{
	"Level":        Info,
	"StdoutLevel":  Info,
	"StderrLevel":  Error,
	"Filename":     values.String("console"),
	"MaxSizeInMb":  values.NonNegativeInteger(500),
	"MaxBackups":   values.NonNegativeInteger(5),
	"MaxAgeInDays": values.NonNegativeInteger(1),
	"Pattern":      Pattern("%d{YYYY-MM-DD HH:mm:ss} [%-5.5p] [%c] %m%n%P{%m}"),
}

// # Description
//
// A logger handles every output generated by the daemon itself, the process or other parts controlled by the daemon.
type Config struct {
	// @default info
	//
	// Minimal log level the logger uses to log error messages. All levels below are ignored.
	Level Level `json:"level" yaml:"level"`

	// @default info
	//
	// If the service prints something to ``stdout``, the instance will be logged with the corresponding instance level.
	StdoutLevel Level `json:"stdoutLevel" yaml:"stdoutLevel"`