Add calling method to debug level log messages
This commit is contained in:
parent
2c092e8d04
commit
d7a82e353b
@ -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")
|
ipc = viper.GetString("client.ipcpath")
|
||||||
levelDbPath = viper.GetString("client.leveldbpath")
|
levelDbPath = viper.GetString("client.leveldbpath")
|
||||||
storageDiffsPath = viper.GetString("filesystem.storageDiffsPath")
|
storageDiffsPath = viper.GetString("filesystem.storageDiffsPath")
|
||||||
@ -89,12 +89,15 @@ func database(cmd *cobra.Command, args []string) {
|
|||||||
viper.Set("database.config", databaseConfig)
|
viper.Set("database.config", databaseConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
func logLevel(cmd *cobra.Command, args []string) error {
|
func logLevel() error {
|
||||||
lvl, err := log.ParseLevel(viper.GetString("log.level"))
|
lvl, err := log.ParseLevel(viper.GetString("log.level"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.SetLevel(lvl)
|
log.SetLevel(lvl)
|
||||||
|
if lvl > log.InfoLevel {
|
||||||
|
log.SetReportCaller(true)
|
||||||
|
}
|
||||||
log.Info("Log level set to ", lvl.String())
|
log.Info("Log level set to ", lvl.String())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -4,4 +4,4 @@
|
|||||||
port = 5432
|
port = 5432
|
||||||
|
|
||||||
[client]
|
[client]
|
||||||
ipcPath = ""
|
ipcPath = "https://kovan.infura.io/v3/be5f83b248b74b34890cbf76e0945e29"
|
||||||
|
4
main.go
4
main.go
@ -3,15 +3,15 @@ package main
|
|||||||
import (
|
import (
|
||||||
"github.com/vulcanize/vulcanizedb/cmd"
|
"github.com/vulcanize/vulcanizedb/cmd"
|
||||||
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.SetFormatter(&log.JSONFormatter{
|
log.SetFormatter(&log.JSONFormatter{
|
||||||
PrettyPrint: true,
|
PrettyPrint: true,
|
||||||
})
|
})
|
||||||
log.SetReportCaller(true)
|
|
||||||
file, err := os.OpenFile("vulcanizedb.log",
|
file, err := os.OpenFile("vulcanizedb.log",
|
||||||
os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
|
os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user