fleet/server/logging/nanodep.go
Victor Lyuboslavsky ae0ea39b7e
Migrated to slog method signatures in service files (#40468)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or
remove if NA -->
**Related issue:** Resolves #40054 

# Checklist for submitter
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
  - Changes present in previous PR

## Testing

- [x] Added/updated automated tests
- [x] QA'd all new/changed functionality manually

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **Refactor**
* Updated internal logging infrastructure to use context-aware logging
methods throughout the system, improving context propagation for better
debugging and observability while maintaining existing log coverage and
behavior.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-26 07:16:44 -06:00

36 lines
730 B
Go

package logging
import (
"context"
"log/slog"
nanodep_log "github.com/fleetdm/fleet/v4/server/mdm/nanodep/log"
)
// NanoDEPLogger is a logger adapter for nanodep.
type NanoDEPLogger struct {
ctx context.Context
logger *slog.Logger
}
func NewNanoDEPLogger(ctx context.Context, logger *slog.Logger) *NanoDEPLogger {
return &NanoDEPLogger{
ctx: ctx,
logger: logger,
}
}
func (l *NanoDEPLogger) Info(keyvals ...any) {
l.logger.InfoContext(l.ctx, "", keyvals...)
}
func (l *NanoDEPLogger) Debug(keyvals ...any) {
l.logger.DebugContext(l.ctx, "", keyvals...)
}
func (l *NanoDEPLogger) With(keyvals ...any) nanodep_log.Logger {
return &NanoDEPLogger{
ctx: l.ctx,
logger: l.logger.With(keyvals...),
}
}