Documentation ¶
Index ¶
- Constants
- func NewHttpWriter(url string) io.Writer
- func NewJsonFormatter() *jsonFormatter
- type AggregateField
- type BasicLogger
- type ConditionalFilter
- type Field
- func BlockHeight(value primitives.BlockHeight) *Field
- func Bytes(key string, value []byte) *Field
- func Error(value error) *Field
- func Float32(key string, value float32) *Field
- func Float64(key string, value float64) *Field
- func Function(value string) *Field
- func Int(key string, value int) *Field
- func Int32(key string, value int32) *Field
- func Int64(key string, value int64) *Field
- func Node(value string) *Field
- func Query(queryHash primitives.Sha256) *Field
- func Service(value string) *Field
- func Source(value string) *Field
- func String(key string, value string) *Field
- func Stringable(key string, value fmt.Stringer) *Field
- func StringableSlice(key string, values interface{}) *Field
- func Timestamp(key string, value time.Time) *Field
- func TimestampNano(key string, value primitives.TimestampNano) *Field
- func Transaction(txHash primitives.Sha256) *Field
- func Uint(key string, value uint) *Field
- func Uint32(key string, value uint32) *Field
- func Uint64(key string, value uint64) *Field
- func VirtualChainId(value primitives.VirtualChainId) *Field
- type FieldType
- type Filter
- func DiscardAll() Filter
- func ExcludeEntryPoint(name string) Filter
- func ExcludeField(field *Field) Filter
- func IgnoreErrorsMatching(pattern string) Filter
- func IgnoreMessagesMatching(pattern string) Filter
- func IncludeFieldWithKey(key string) Filter
- func MatchField(f *Field) Filter
- func OnlyCheckpoints() Filter
- func OnlyErrors() Filter
- func OnlyMetrics() Filter
- func Or(filters ...Filter) Filter
- type LogFormatter
- type Output
- type TLog
- type TestOutput
- type TruncatingFileWriter
Constants ¶
View Source
const ( NoType = iota ErrorType NodeType ServiceType StringType IntType UintType BytesType FloatType FunctionType SourceType StringArrayType TimeType AggregateType )
View Source
const ( SPACE = " " EQUALS = "=" )
View Source
const DEFAULT_TIMESTAMP_COLUMN = "timestamp"
View Source
const POST_TERMINATED_ERROR = "*** Logged error after TestOutput.TestTerminated:"
View Source
const TEST_FAILED_ERROR = "" /* 169-byte string literal not displayed */
View Source
const TEST_RUNNER_PANIC_ERROR = "*** Test runner panic while trying to fail test (try using TestOutput.TestTerminated):"
View Source
const TIMESTAMP_FORMAT = "2006-01-02T15:04:05.999999999Z"
Variables ¶
This section is empty.
Functions ¶
func NewHttpWriter ¶
func NewJsonFormatter ¶
func NewJsonFormatter() *jsonFormatter
Types ¶
type AggregateField ¶
type AggregateField interface {
NestedFields() []*Field
}
type BasicLogger ¶
type BasicLogger interface { Log(level string, message string, params ...*Field) LogFailedExpectation(message string, expected *Field, actual *Field, params ...*Field) Info(message string, params ...*Field) Error(message string, params ...*Field) Metric(params ...*Field) WithTags(params ...*Field) BasicLogger Tags() []*Field WithOutput(writer ...Output) BasicLogger WithFilters(filter ...Filter) BasicLogger Filters() []Filter }
func DefaultTestingLogger ¶ added in v0.8.0
func DefaultTestingLogger(tb testing.TB) BasicLogger
func DefaultTestingLoggerAllowingErrors ¶ added in v0.8.1
func DefaultTestingLoggerAllowingErrors(tb testing.TB, errorPattern string) BasicLogger
func GetLogger ¶
func GetLogger(params ...*Field) BasicLogger
type ConditionalFilter ¶ added in v0.8.1
type ConditionalFilter interface { Filter On() Off() }
func NewConditionalFilter ¶ added in v0.8.1
func NewConditionalFilter(enabled bool, filter Filter) ConditionalFilter
type Field ¶
type Field struct { Key string Type FieldType StringVal string StringArray []string Int int64 Uint uint64 Bytes []byte Float float64 Error error Nested AggregateField }
func BlockHeight ¶
func BlockHeight(value primitives.BlockHeight) *Field
func Query ¶ added in v0.8.0
func Query(queryHash primitives.Sha256) *Field
func StringableSlice ¶
func TimestampNano ¶
func TimestampNano(key string, value primitives.TimestampNano) *Field
func Transaction ¶
func Transaction(txHash primitives.Sha256) *Field
func VirtualChainId ¶
func VirtualChainId(value primitives.VirtualChainId) *Field
type Filter ¶
func DiscardAll ¶
func DiscardAll() Filter
func ExcludeEntryPoint ¶
func ExcludeField ¶
func IgnoreErrorsMatching ¶
func IgnoreMessagesMatching ¶
func IncludeFieldWithKey ¶
func MatchField ¶
func OnlyCheckpoints ¶
func OnlyCheckpoints() Filter
func OnlyErrors ¶
func OnlyErrors() Filter
func OnlyMetrics ¶
func OnlyMetrics() Filter
type LogFormatter ¶
type LogFormatter interface {
FormatRow(timestamp time.Time, level string, message string, params ...*Field) (formattedRow string)
}
func NewHumanReadableFormatter ¶
func NewHumanReadableFormatter() LogFormatter
type Output ¶
func NewBulkOutput ¶
func NewBulkOutput(writer io.Writer, formatter LogFormatter, bulkSize int) Output
func NewFormattingOutput ¶
func NewFormattingOutput(writer io.Writer, formatter LogFormatter) Output
type TLog ¶ added in v0.8.1
type TLog interface { Fatal(args ...interface{}) Log(args ...interface{}) Error(args ...interface{}) Name() string }
type TestOutput ¶ added in v0.8.1
type TestOutput struct {
// contains filtered or unexported fields
}
func NewTestOutput ¶ added in v0.8.0
func NewTestOutput(tb TLog, formatter LogFormatter) *TestOutput
func (*TestOutput) AllowErrorsMatching ¶ added in v0.8.1
func (o *TestOutput) AllowErrorsMatching(pattern string)
func (*TestOutput) Append ¶ added in v0.8.1
func (o *TestOutput) Append(level string, message string, fields ...*Field)
func (*TestOutput) HasErrors ¶ added in v0.8.1
func (o *TestOutput) HasErrors() bool
func (*TestOutput) TestTerminated ¶ added in v0.9.2
func (o *TestOutput) TestTerminated()
the golang test runner throws a severe panic if trying to fail a test after it already passed this happens for example on t.Run where a goroutine logs an Error (which fails the test) after t.Run passed the solution is to add "defer testOutput.TestTerminated()" to execute as the t.Run body is returning
type TruncatingFileWriter ¶ added in v0.8.0
func NewTruncatingFileWriter ¶ added in v0.8.0
func NewTruncatingFileWriter(f *os.File, intervals ...time.Duration) TruncatingFileWriter
Click to show internal directories.
Click to hide internal directories.