moving logging function to common setting up client logging and db
This commit is contained in:
		@@ -7,7 +7,6 @@ import (
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
 | 
			
		||||
	"github.com/deranjer/store"
 | 
			
		||||
	"github.com/rs/zerolog"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// ConfigPath is the global path to the config that is injected from the main server package.
 | 
			
		||||
@@ -35,28 +34,6 @@ func FindConfig() (string, error) {
 | 
			
		||||
	return "", fmt.Errorf("serverConfig.toml does not appear to be in the correct file format")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SetLogLevel takes in the integer supplied and turns it into a log level
 | 
			
		||||
func SetLogLevel(loglevel int) (level zerolog.Level, err error) {
 | 
			
		||||
	switch loglevel {
 | 
			
		||||
	case -1:
 | 
			
		||||
		return zerolog.TraceLevel, nil
 | 
			
		||||
	case 0:
 | 
			
		||||
		return zerolog.DebugLevel, nil
 | 
			
		||||
	case 1:
 | 
			
		||||
		return zerolog.InfoLevel, nil
 | 
			
		||||
	case 2:
 | 
			
		||||
		return zerolog.WarnLevel, nil
 | 
			
		||||
	case 3:
 | 
			
		||||
		return zerolog.ErrorLevel, nil
 | 
			
		||||
	case 4:
 | 
			
		||||
		return zerolog.FatalLevel, nil
 | 
			
		||||
	case 5:
 | 
			
		||||
		return zerolog.PanicLevel, nil
 | 
			
		||||
	default:
 | 
			
		||||
		return zerolog.InfoLevel, fmt.Errorf("incorrect log level set, setting it to info level")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// ValidateConfig will go through the entire config and do basic sanity checks and write valid values to the server struct if some are missing
 | 
			
		||||
func ValidateConfig(conf *GvcServerConfig, configPath string, version string) error {
 | 
			
		||||
	if conf.Version == "" { // No version found, should we update it?
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user