//loadConfig function will load the log configuration.
loadConfig function will load the log configuration.
// loadConfig function will load the log configuration .
func loadConfig() *LogConfig {
	var logConfig = &LogConfig{}
	fileName := config.GetEnvAsString(LogConfigEnvProperty, DefaultlogFilePath)
	if fsutils.FileExists(fileName) {
		contentType := fsutils.LookupContentType(fileName)
		if contentType == "application/json" {
			logConfigFile, err := os.Open(fileName)
			if err != nil {
				writeLog(os.Stderr, "Unable to open the log config file using default log configuration", err)
				logConfig = loadDefaultConfig()
			} else {
				defer logConfigFile.Close()
				bytes, _ := ioutil.ReadAll(logConfigFile)
				err = json.Unmarshal(bytes, &logConfig)
				if err != nil {
					writeLog(os.Stderr, "Unable to open the log config file using default log config", err)
					logConfig = loadDefaultConfig()
				}
			}
		} else {
			writeLog(os.Stderr, "Invalid file format supported format : application/json . Loading Default configuration")
			logConfig = loadDefaultConfig()
		}
	} else {
		writeLog(os.Stderr, "Log Config file not found. Loading default configuration")
		logConfig = loadDefaultConfig()
	}
	return logConfig
}
func loadConfig ( ) * LogConfig { var logConfig = & LogConfig { } fileName := config . GetEnvAsString ( LogConfigEnvProperty , DefaultlogFilePath ) if fsutils . FileExists ( fileName ) { contentType := fsutils . LookupContentType ( fileName ) if contentType == " " { logConfigFile , err := os . Open ( fileName ) if err != nil { writeLog ( os . Stderr , " " , err ) logConfig = loadDefaultConfig ( ) } else { defer logConfigFile . Close ( ) bytes , _ := ioutil . ReadAll ( logConfigFile ) err = json . Unmarshal ( bytes , & logConfig ) if err != nil { writeLog ( os . Stderr , " " , err ) logConfig = loadDefaultConfig ( ) } } } else { writeLog ( os . Stderr , " " ) logConfig = loadDefaultConfig ( ) } } else { writeLog ( os . Stderr , " " ) logConfig = loadDefaultConfig ( ) } return logConfig }
loadConfig function will load the log configuration.
loadConfig function will load the log configuration .
//TODO Add yaml support once its available