mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-06-03 01:44:53 +00:00
Enable debug mode from different places (#287)
This commit is contained in:
parent
80aad89fa8
commit
1cca516738
20
main.go
20
main.go
@ -801,9 +801,25 @@ The kairos agent is a component to abstract away node ops, providing a common fe
|
|||||||
UsageText: ``,
|
UsageText: ``,
|
||||||
Copyright: "kairos authors",
|
Copyright: "kairos authors",
|
||||||
Before: func(c *cli.Context) error {
|
Before: func(c *cli.Context) error {
|
||||||
// Set debug from here already, so it's loaded by the ReadConfigRun
|
var debug bool
|
||||||
viper.Set("debug", c.Bool("debug"))
|
// Get debug from env or cmdline
|
||||||
|
cmdline, _ := os.ReadFile("/proc/cmdline")
|
||||||
|
if strings.Contains(string(cmdline), "rd.kairos.debug") {
|
||||||
|
debug = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if os.Getenv("KAIROS_AGENT_DEBUG") == "true" {
|
||||||
|
debug = true
|
||||||
|
}
|
||||||
|
|
||||||
if c.Bool("debug") {
|
if c.Bool("debug") {
|
||||||
|
debug = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set debug from here already, so it's loaded by the Config unmarshall
|
||||||
|
viper.Set("debug", debug)
|
||||||
|
if debug {
|
||||||
|
// Dont hide private fields, we want the full object biew
|
||||||
litter.Config.HidePrivateFields = false
|
litter.Config.HidePrivateFields = false
|
||||||
// Hide logger and client fields from litter as otherwise the config dumps are huge and a bit useless
|
// Hide logger and client fields from litter as otherwise the config dumps are huge and a bit useless
|
||||||
litter.Config.FieldExclusions = regexp.MustCompile(`Logger|logger|Client`)
|
litter.Config.FieldExclusions = regexp.MustCompile(`Logger|logger|Client`)
|
||||||
|
Loading…
Reference in New Issue
Block a user