mirror of https://github.com/databricks/cli.git
Log process ID in each log entry (#949)
## Changes This will help differentiate multiple cli commands that write to the same log file. Noticed that the root module wasn't using the common log utilities, refactored it to avoid missing log arguments. Relevant PR on the databricks vscode extension side: https://github.com/databricks/databricks-vscode/pull/923 ## Tests Tested manually for sdk and cli loggers
This commit is contained in:
parent
7509e4d55a
commit
65dd9c5c0f
|
@ -5,6 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/databricks/cli/libs/cmdio"
|
"github.com/databricks/cli/libs/cmdio"
|
||||||
"github.com/databricks/cli/libs/env"
|
"github.com/databricks/cli/libs/env"
|
||||||
|
@ -113,7 +114,7 @@ func (f *logFlags) initializeContext(ctx context.Context) (context.Context, erro
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
slog.SetDefault(slog.New(handler))
|
slog.SetDefault(slog.New(handler).With(slog.Int("pid", os.Getpid())))
|
||||||
return log.NewContext(ctx, slog.Default()), nil
|
return log.NewContext(ctx, slog.Default()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue