File: nullout.go

package info (click to toggle)
podman 5.7.0%2Bds2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,824 kB
  • sloc: sh: 4,700; python: 2,798; perl: 1,885; ansic: 1,484; makefile: 977; ruby: 42; csh: 8
file content (25 lines) | stat: -rw-r--r-- 563 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package events

import (
	"context"
	"errors"
)

// EventToNull is an eventer type that does nothing.
// It is meant for unit tests only
type EventToNull struct{}

// Write eats the event and always returns nil
func (e EventToNull) Write(_ Event) error {
	return nil
}

// Read does nothing and returns an error.
func (e EventToNull) Read(_ context.Context, _ ReadOptions) error {
	return errors.New("cannot read events with the \"none\" backend")
}

// String returns a string representation of the logger
func (e EventToNull) String() string {
	return "none"
}