nop.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package log
  2. import "context"
  3. var _ Factory = (*nopFactory)(nil)
  4. type nopFactory struct{}
  5. func NewNOPFactory() Factory {
  6. return (*nopFactory)(nil)
  7. }
  8. func (f *nopFactory) Level() Level {
  9. return LevelTrace
  10. }
  11. func (f *nopFactory) SetLevel(level Level) {
  12. }
  13. func (f *nopFactory) Logger() ContextLogger {
  14. return f
  15. }
  16. func (f *nopFactory) NewLogger(tag string) ContextLogger {
  17. return f
  18. }
  19. func (f *nopFactory) Trace(args ...any) {
  20. }
  21. func (f *nopFactory) Debug(args ...any) {
  22. }
  23. func (f *nopFactory) Info(args ...any) {
  24. }
  25. func (f *nopFactory) Warn(args ...any) {
  26. }
  27. func (f *nopFactory) Error(args ...any) {
  28. }
  29. func (f *nopFactory) Fatal(args ...any) {
  30. }
  31. func (f *nopFactory) Panic(args ...any) {
  32. }
  33. func (f *nopFactory) TraceContext(ctx context.Context, args ...any) {
  34. }
  35. func (f *nopFactory) DebugContext(ctx context.Context, args ...any) {
  36. }
  37. func (f *nopFactory) InfoContext(ctx context.Context, args ...any) {
  38. }
  39. func (f *nopFactory) WarnContext(ctx context.Context, args ...any) {
  40. }
  41. func (f *nopFactory) ErrorContext(ctx context.Context, args ...any) {
  42. }
  43. func (f *nopFactory) FatalContext(ctx context.Context, args ...any) {
  44. }
  45. func (f *nopFactory) PanicContext(ctx context.Context, args ...any) {
  46. }