Flag for Logger Config yaml file name

Removed yaml filename from env.go and added its flag to scheduler.go
This commit is contained in:
balandi1 2019-11-26 13:08:45 -05:00
parent ef6d154d06
commit 24dbbb208f
5 changed files with 8 additions and 9 deletions

View file

@ -14,10 +14,10 @@ var formatter ElektronFormatter
var ElektronLog *LoggerImpl
var logDir logDirectory
func BuildLogger(prefix string) {
func BuildLogger(prefix string, logConfigFilename string) {
// read configuration from yaml
config.GetConfig()
config.GetConfig(logConfigFilename)
// create the log directory
startTime := time.Now()

View file

@ -13,7 +13,7 @@ type Logger interface {
type LoggerImpl struct {
Type int
AllowOnConsole bool
LogFile *os.File
LogFile *os.File
next Logger
}

View file

@ -2,7 +2,6 @@ package elektronLogging
import (
log "github.com/sirupsen/logrus"
elekEnv "github.com/spdfg/elektron/environment"
"gopkg.in/yaml.v2"
"io/ioutil"
)
@ -48,9 +47,9 @@ type LoggerConfig struct {
Format []string `yaml:"format"`
}
func (c *LoggerConfig) GetConfig() *LoggerConfig {
func (c *LoggerConfig) GetConfig(logConfigFilename string) *LoggerConfig {
yamlFile, err := ioutil.ReadFile(elekEnv.LogConfigYaml)
yamlFile, err := ioutil.ReadFile(logConfigFilename)
if err != nil {
log.Printf("Error in reading yaml file #%v ", err)
}