Skip to content

Commit

Permalink
Merge pull request #626 from swagatbora90/main
Browse files Browse the repository at this point in the history
fix: check logger nil after applying opts
  • Loading branch information
swagatbora90 authored Feb 11, 2025
2 parents 03dbe20 + 8a89003 commit 563df78
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,6 @@ func NewMachine(ctx context.Context, cfg Config, opts ...Opt) (*Machine, error)
m.cmd = configureBuilder(defaultFirecrackerVMMCommandBuilder, cfg).Build(ctx)
}

if m.logger == nil {
logger := log.New()

m.logger = log.NewEntry(logger)
}

if m.client == nil {
m.client = NewClient(cfg.SocketPath, m.logger, false)
}
Expand All @@ -415,6 +409,12 @@ func NewMachine(ctx context.Context, cfg Config, opts ...Opt) (*Machine, error)
opt(m)
}

if m.logger == nil {
logger := log.New()

m.logger = log.NewEntry(logger)
}

m.logger.Debug("Called NewMachine()")
return m, nil
}
Expand Down

0 comments on commit 563df78

Please sign in to comment.