Add Error logging and hclog.Logger debug logging throughout the daemon (#4384) (#4439)

* Save and assign hclogger throughout the client cache daemon

* Don't event for errors happening outside of the handlers or tickers.

* Hide and ignore -store-debug and expose the -log-level flag
This commit is contained in:
Todd authored and GitHub committed 2024-02-22 10:20:48 -08:00
1 parent 014a5a7aae
commit 366d9e95aa
14 files changed
+298 -147

No files matched your search

+6 -6
View File
@@ -82,7 +82,6 @@ func (c *StartCommand) Flags() *base.FlagSets {
Completion: complete.PredictSet("trace", "debug", "info", "warn", "err"),
Usage: "Log verbosity level, mostly as a fallback for events. Supported values (in order of more detail to less) are " +
"\"trace\", \"debug\", \"info\", \"warn\", and \"err\".",
Hidden: true,
})
f.StringVar(&base.StringVar{
Name: "log-format",
@@ -125,8 +124,9 @@ func (c *StartCommand) Flags() *base.FlagSets {
Name: "store-debug",
Target: &c.flagStoreDebug,
Default: false,
Usage: `Turn on sqlite query debugging`,
Usage: `Turn on sqlite query debugging. This is deprecated. Users should use -log-level=debug instead.`,
Aliases: []string{"d"},
Hidden: true,
})
f.BoolVar(&base.BoolVar{
Name: "background",
@@ -191,6 +191,10 @@ func (c *StartCommand) Run(args []string) int {
defer lf.Close()
writers = append(writers, lf)
if c.flagStoreDebug {
c.UI.Warn("The -store-debug flag is now ignored. Use -log-level=debug instead for debugging purposes.")
}
cfg := &daemon.Config{
ContextCancel: cancel,
RefreshInterval: c.flagRefreshInterval,
@@ -198,7 +202,6 @@ func (c *StartCommand) Run(args []string) int {
MaxSearchStaleness: c.flagMaxSearchStaleness,
MaxSearchRefreshTimeout: c.flagMaxSearchRefreshTimeout,
DatabaseUrl: c.flagDatabaseUrl,
StoreDebug: c.flagStoreDebug,
LogLevel: c.flagLogLevel,
LogFormat: c.flagLogFormat,
LogWriter: io.MultiWriter(writers...),
@@ -319,9 +322,6 @@ func (c *StartCommand) makeBackground(ctx context.Context, dotDir string) (bool,
if c.flagDatabaseUrl != "" {
args = append(args, "-database-url", c.flagDatabaseUrl)
}
if c.flagStoreDebug {
args = append(args, "-store-debug")
}
cmd := exec.Command(absPath, args...)
cmd.Env = env
if err = cmd.Start(); err != nil {