Documentation ¶
Index ¶
- func IsTemporary(err error) bool
- func IsUserVisibleError(err error) bool
- func Logger(ctx context.Context) logrus.FieldLogger
- func LoggerWithFields(ctx context.Context, fields logrus.Fields) (context.Context, logrus.FieldLogger)
- func NewRNG(seed int64) *rand.Rand
- func NewSyslogHook(url *url.URL, prefix string) error
- func SetLogDest(to, prefix string)
- func SetLogLevel(ll string)
- func UserError(err error) error
- func WithLogger(ctx context.Context, l logrus.FieldLogger) context.Context
- type Backoff
- type BoxTime
- type Clock
- type Environment
- type HeadLinesWriter
- type LineWriter
- type TailLinesWriter
- type Temporary
- type UserVisibleError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTemporary ¶
func IsUserVisibleError ¶
func Logger ¶
func Logger(ctx context.Context) logrus.FieldLogger
Logger returns the structured logger.
func LoggerWithFields ¶
func LoggerWithFields(ctx context.Context, fields logrus.Fields) (context.Context, logrus.FieldLogger)
Attempt at simplifying this whole logger in the context thing Could even make this take a generic map, then the logger that gets returned could be used just like the stdlib too, since it's compatible
func SetLogDest ¶
func SetLogDest(to, prefix string)
func SetLogLevel ¶
func SetLogLevel(ll string)
func WithLogger ¶
WithLogger stores the logger.
Types ¶
type Environment ¶
func NewEnvironment ¶
func NewEnvironment(initializers ...func(e *Environment)) *Environment
Initializers are functions that may set up the environment as they like. By default the environment is 'inactive' in the sense that metrics aren't reported.
type HeadLinesWriter ¶
type HeadLinesWriter struct {
// contains filtered or unexported fields
}
HeadLinesWriter stores upto the first N lines in a buffer that can be retrieved via Head().
func NewHeadLinesWriter ¶
func NewHeadLinesWriter(max int) *HeadLinesWriter
func (*HeadLinesWriter) Head ¶
func (h *HeadLinesWriter) Head() []byte
The returned bytes alias the buffer, the same restrictions as bytes.Buffer.Bytes() apply.
type LineWriter ¶
type LineWriter struct {
// contains filtered or unexported fields
}
lineWriter will break apart a stream of data into individual lines. Downstream writer will be called for each complete new line. When Flush is called, a newline will be appended if there isn't one at the end. Not thread-safe
func NewLineWriter ¶
func NewLineWriter(w io.Writer) *LineWriter
func (*LineWriter) Flush ¶
func (li *LineWriter) Flush() (int, error)
type TailLinesWriter ¶
type TailLinesWriter struct {
// contains filtered or unexported fields
}
TailLinesWriter stores upto the last N lines in a buffer that can be retrieved via Tail(). The truncation is only performed when more bytes are received after '\n', so the buffer contents for both these writes are identical.
tail writer that captures last 3 lines. 'a\nb\nc\nd\n' -> 'b\nc\nd\n' 'a\nb\nc\nd' -> 'b\nc\nd'
func NewTailLinesWriter ¶
func NewTailLinesWriter(max int) *TailLinesWriter
func (*TailLinesWriter) Tail ¶
func (t *TailLinesWriter) Tail() []byte
The returned bytes alias the buffer, the same restrictions as bytes.Buffer.Bytes() apply.
Once Tail() is called, further Write()s error.
type UserVisibleError ¶
type UserVisibleError interface {
UserVisible() bool
}
Errors that can be directly exposed to task creators/users.