Skip to content

Commit

Permalink
Remove original loggeR
Browse files Browse the repository at this point in the history
  • Loading branch information
hexbabe committed Nov 14, 2024
1 parent f9ad184 commit f75edc0
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions components/camera/videosource/webcam.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ type webcam struct {
disconnected bool
activeBackgroundWorkers sync.WaitGroup
logger logging.Logger
originalLogger logging.Logger
}

// NewWebcam returns the webcam discovered based on the given config as the Camera interface type.
Expand All @@ -344,11 +343,10 @@ func NewWebcam(
cancelCtx, cancel := context.WithCancel(context.Background())

cam := &webcam{
Named: conf.ResourceName().AsNamed(),
logger: logger.WithFields("camera_name", conf.ResourceName().ShortName()),
originalLogger: logger,
cancelCtx: cancelCtx,
cancel: cancel,
Named: conf.ResourceName().AsNamed(),
logger: logger.WithFields("camera_name", conf.ResourceName().ShortName()),
cancelCtx: cancelCtx,
cancel: cancel,
}
if err := cam.Reconfigure(ctx, deps, conf); err != nil {
return nil, err
Expand Down Expand Up @@ -475,7 +473,7 @@ func (c *webcam) reconnectCamera(conf *WebcamConfig) error {
c.targetPath = foundLabel
}

c.logger = c.originalLogger.WithFields("camera_label", c.targetPath)
c.logger = c.logger.WithFields("camera_label", c.targetPath)

return nil
}
Expand Down

0 comments on commit f75edc0

Please sign in to comment.