mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 16:42:15 +01:00
33 lines
634 B
Go
33 lines
634 B
Go
package chromium
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"io"
|
|
"log/slog"
|
|
)
|
|
|
|
// debugLogger is wrapper around a [slog.Logger] which is used for debugging
|
|
// Chromium.
|
|
type debugLogger struct {
|
|
ctx context.Context
|
|
logger *slog.Logger
|
|
}
|
|
|
|
// Write logs the bytes in a debug message.
|
|
func (debug *debugLogger) Write(p []byte) (n int, err error) {
|
|
debug.logger.DebugContext(debug.ctx, string(p))
|
|
|
|
return len(p), nil
|
|
}
|
|
|
|
// Printf logs a debug message.
|
|
func (debug *debugLogger) Printf(format string, v ...any) {
|
|
debug.logger.DebugContext(debug.ctx, fmt.Sprintf(format, v...))
|
|
}
|
|
|
|
// Interface guards.
|
|
var (
|
|
_ io.Writer = (*debugLogger)(nil)
|
|
)
|