Add calling method to debug level log messages

This commit is contained in:
Andrew J Yao
2019-07-23 08:08:15 -07:00
parent 2c092e8d04
commit d7a82e353b
3 changed files with 8 additions and 5 deletions
+5 -2
View File
@@ -75,7 +75,7 @@ func initFuncs(cmd *cobra.Command, args []string) {
}
func database(cmd *cobra.Command, args []string) {
func database() {
ipc = viper.GetString("client.ipcpath")
levelDbPath = viper.GetString("client.leveldbpath")
storageDiffsPath = viper.GetString("filesystem.storageDiffsPath")
@@ -89,12 +89,15 @@ func database(cmd *cobra.Command, args []string) {
viper.Set("database.config", databaseConfig)
}
func logLevel(cmd *cobra.Command, args []string) error {
func logLevel() error {
lvl, err := log.ParseLevel(viper.GetString("log.level"))
if err != nil {
return err
}
log.SetLevel(lvl)
if lvl > log.InfoLevel {
log.SetReportCaller(true)
}
log.Info("Log level set to ", lvl.String())
return nil
}