Documentation
¶
Index ¶
- func MakeLogger(name string, opts *LoggerOptions) (send.Sender, error)
- func MakeLoggerWithContext(ctx context.Context, name string, opts *LoggerOptions) (send.Sender, error)
- func NewLogger(name string, l send.LevelInfo, opts *LoggerOptions) (send.Sender, error)
- func NewLoggerWithContext(ctx context.Context, name string, l send.LevelInfo, opts *LoggerOptions) (send.Sender, error)
- type JasperLoggerOptions
- type LogFormat
- type LogStorage
- type LoggerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeLogger ¶
func MakeLogger(name string, opts *LoggerOptions) (send.Sender, error)
MakeLogger returns a grip Sender backed by cedar Buildlogger.
func MakeLoggerWithContext ¶
func MakeLoggerWithContext(ctx context.Context, name string, opts *LoggerOptions) (send.Sender, error)
MakeLoggerWithContext returns a grip Sender backed by cedar Buildlogger using the passed in context.
Types ¶
type JasperLoggerOptions ¶
type JasperLoggerOptions struct {
Name string `json:"name" bson:"name"`
Level send.LevelInfo `json:"level" bson:"level"`
BuildloggerV3 LoggerOptions `json:"buildloggerv3" bson:"buildloggerv3"`
}
JasperLoggerOptions wraps LoggerOptions and implements a jasper options.LoggerProducer for BuildloggerV3.
func NewBuildloggerV3LoggerProducer ¶
func NewBuildloggerV3LoggerProducer() *JasperLoggerOptions
NewBuildloggerV3LoggerProducer returns a jasper options.LoggerProducer backed by JasperLoggerOptions.
func (*JasperLoggerOptions) Configure ¶
func (opts *JasperLoggerOptions) Configure() (send.Sender, error)
func (*JasperLoggerOptions) Type ¶
func (opts *JasperLoggerOptions) Type() string
type LogStorage ¶
type LogStorage int32
LogStorage describes the blob storage location type of the log.
const ( LogStorageS3 LogStorage = 0 LogStorageGridFS LogStorage = 1 LogStorageLocal LogStorage = 2 )
Valid LogStorage values.
type LoggerOptions ¶
type LoggerOptions struct {
// Unique information to identify the log.
Project string `bson:"project" json:"project" yaml:"project"`
Version string `bson:"version" json:"version" yaml:"version"`
Variant string `bson:"variant" json:"variant" yaml:"variant"`
TaskName string `bson:"task_name" json:"task_name" yaml:"task_name"`
TaskID string `bson:"task_id" json:"task_id" yaml:"task_id"`
Execution int32 `bson:"execution" json:"execution" yaml:"execution"`
TestName string `bson:"test_name" json:"test_name" yaml:"test_name"`
Trial int32 `bson:"trial" json:"trial" yaml:"trial"`
ProcessName string `bson:"proc_name" json:"proc_name" yaml:"proc_name"`
Format LogFormat `bson:"format" json:"format" yaml:"format"`
Tags []string `bson:"tags" json:"tags" yaml:"tags"`
Arguments map[string]string `bson:"args" json:"args" yaml:"args"`
Mainline bool `bson:"mainline" json:"mainline" yaml:"mainline"`
// Storage location type for this log.
Storage LogStorage `bson:"storage" json:"storage" yaml:"storage"`
// Configure a local sender for "fallback" operations and to collect
// the location of the buildlogger output.
Local send.Sender `bson:"-" json:"-" yaml:"-"`
// The number max number of bytes to buffer before sending log data
// over rpc to cedar. Defaults to 10MB.
MaxBufferSize int `bson:"max_buffer_size" json:"max_buffer_size" yaml:"max_buffer_size"`
// The interval at which to flush log lines, regardless of whether the
// max buffer size has been reached or not. Setting FlushInterval to a
// duration less than 0 will disable timed flushes. Defaults to 1
// minute.
FlushInterval time.Duration `bson:"flush_interval" json:"flush_interval" yaml:"flush_interval"`
// Disable checking for new lines in messages. If this is set to true,
// make sure log messages do not contain new lines, otherwise the logs
// will be stored incorrectly.
DisableNewLineCheck bool `bson:"disable_new_line_check" json:"disable_new_line_check" yaml:"disable_new_line_check"`
// The gRPC client connection. If nil, a new connection will be
// established with the gRPC connection configuration.
ClientConn *grpc.ClientConn `bson:"-" json:"-" yaml:"-"`
// Configuration for gRPC client connection.
HTTPClient *http.Client `bson:"-" json:"-" yaml:"-"`
BaseAddress string `bson:"base_address" json:"base_address" yaml:"base_address"`
RPCPort string `bson:"rpc_port" json:"rpc_port" yaml:"rpc_port"`
Insecure bool `bson:"insecure" json:"insecure" yaml:"insecure"`
Username string `bson:"username" json:"username" yaml:"username"`
APIKey string `bson:"api_key" json:"api_key" yaml:"api_key"`
// contains filtered or unexported fields
}
LoggerOptions support the use and creation of a Buildlogger log.
func LoadLoggerOptions ¶
func LoadLoggerOptions(fn string) (*LoggerOptions, error)
LoadLoggerOptions reads the content of the specified file and attempts to create a LoggerOptions structure based on the content. The file can be in json or yaml, LoadLoggerOptions examines the file's extension to determine the data format.
func (*LoggerOptions) GetLogID ¶
func (opts *LoggerOptions) GetLogID() string
GetLogID returns the unique buildlogger log ID set after NewLogger is called.
func (*LoggerOptions) SetExitCode ¶
func (opts *LoggerOptions) SetExitCode(i int32)
SetExitCode sets the exit code variable.