Skip to content

Commit

Permalink
re enable debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
zulkhair committed Jun 13, 2024
1 parent 8685e76 commit bb3a8ae
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/world/cardinal/restart.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This will restart the following Docker services:
if cfg.Debug {
err = teacmd.DockerRestart(cfg, []teacmd.DockerService{
teacmd.DockerServiceCardinalDebug,
teacmd.DockerServiceNakama,
teacmd.DockerServiceNakamaDebug,
})
} else {
err = teacmd.DockerRestart(cfg, []teacmd.DockerService{
Expand Down
1 change: 1 addition & 0 deletions cmd/world/cardinal/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func init() {
startCmd.Flags().Bool(flagBuild, true, "Rebuild Docker images before starting")
startCmd.Flags().Bool(flagDetach, false, "Run in detached mode")
startCmd.Flags().String(flagLogLevel, "", "Set the log level")
startCmd.Flags().Bool(flagDebug, false, "Enable delve debugging")
}

// replaceBoolWithFlag overwrites the contents of vale with the contents of the given flag. If the flag
Expand Down
10 changes: 5 additions & 5 deletions common/logger/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const (
DefaultTimeFormat = "15:04:05.000"
DefaultCallerSkipFrameCount = 3 // set to 3 because logger wrapped in logger.go

NoColor = true
UseCaller = false // for developer, if you want to expose line of code of caller
flagDebug = "log-debug"
NoColor = true
UseCaller = false // for developer, if you want to expose line of code of caller
flagLogDebug = "log-debug"
)

var (
Expand Down Expand Up @@ -65,7 +65,7 @@ func PrintLogs() {
// SetDebugMode Allow particular logger/message to be printed
// This function will extract flag --log-debug from command
func SetDebugMode(cmd *cobra.Command) {
val, err := cmd.Flags().GetBool(flagDebug)
val, err := cmd.Flags().GetBool(flagLogDebug)
if err == nil {
DebugMode = val
}
Expand All @@ -74,6 +74,6 @@ func SetDebugMode(cmd *cobra.Command) {
// AddLogFlag set flag --log-debug
func AddLogFlag(cmd ...*cobra.Command) {
for _, c := range cmd {
c.Flags().Bool(flagDebug, false, "Enable World CLI debug logs")
c.Flags().Bool(flagLogDebug, false, "Enable World CLI debug logs")
}
}
7 changes: 4 additions & 3 deletions common/teacmd/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (
DockerServiceEVM DockerService = "evm"
DockerServiceDA DockerService = "celestia-devnet"
DockerServiceCardinalDebug DockerService = "cardinal-debug"
DockerServiceNakamaDebug DockerService = "nakama-debug"
)

type DockerService string
Expand Down Expand Up @@ -98,15 +99,14 @@ func DockerStart(cfg *config.Config, services []DockerService) error {
// DockerStartAll starts both cardinal and nakama
func DockerStartAll(cfg *config.Config) error {
services := []DockerService{
DockerServiceNakama,
DockerServiceNakamaDB,
DockerServiceRedis,
}

if cfg.Debug {
services = append(services, DockerServiceCardinalDebug)
services = append(services, DockerServiceCardinalDebug, DockerServiceNakamaDebug)
} else {
services = append(services, DockerServiceCardinal)
services = append(services, DockerServiceCardinal, DockerServiceNakama)
}

return DockerStart(cfg, services)
Expand Down Expand Up @@ -150,6 +150,7 @@ func DockerStopAll() error {
DockerServiceCardinal,
DockerServiceCardinalDebug,
DockerServiceNakama,
DockerServiceNakamaDebug,
DockerServiceNakamaDB,
DockerServiceRedis,
})
Expand Down

0 comments on commit bb3a8ae

Please sign in to comment.