Skip to content

Commit

Permalink
feat: added debug flag to increase verbosity
Browse files Browse the repository at this point in the history
Signed-off-by: Adrian Riobo <[email protected]>
  • Loading branch information
adrianriobo committed Dec 17, 2024
1 parent b9f1dc9 commit ed716f9
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ type ManagerOptions struct {
Baground bool
}

var logLevel uint = 9

func UpStack(targetStack Stack, opts ...ManagerOptions) (auto.UpResult, error) {
return UpStackTargets(targetStack, nil, opts...)
}
Expand All @@ -38,11 +40,14 @@ func UpStackTargets(targetStack Stack, targetURNs []string, opts ...ManagerOptio
// TODO add when loglevel debug control in place
w := logging.GetWritter()
defer w.Close()
var logLevel uint = 10
mOpts := []optup.Option{
optup.ProgressStreams(w),
optup.DebugLogging(
debug.LoggingOptions{LogLevel: &logLevel}),
debug.LoggingOptions{
LogLevel: &logLevel,
Debug: true,
FlowToPlugins: true,
LogToStdErr: true}),
}
if len(targetURNs) > 0 {
mOpts = append(mOpts, optup.Target(targetURNs))
Expand All @@ -64,8 +69,16 @@ func DestroyStack(targetStack Stack, opts ...ManagerOptions) (err error) {
objectStack := getStack(ctx, targetStack)
w := logging.GetWritter()
defer w.Close()
stdoutStreamer := optdestroy.ProgressStreams(w)
if _, err := objectStack.Destroy(ctx, stdoutStreamer); err != nil {
// stdoutStreamer := optdestroy.ProgressStreams(w)
mOpts := []optdestroy.Option{
optdestroy.ProgressStreams(w),
optdestroy.DebugLogging(
debug.LoggingOptions{
LogLevel: &logLevel,
FlowToPlugins: true,
LogToStdErr: true}),
}
if _, err := objectStack.Destroy(ctx, mOpts...); err != nil {
logging.Error(err)
os.Exit(1)
}
Expand Down

0 comments on commit ed716f9

Please sign in to comment.