Documentation ¶
Overview ¶
Package logservice provides loggers which can be used to to collect and send batches of logs to the eventlog service.
Package logservice provides a client which can be used to to collect and send batches of logs to the eventlog service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BatchLogger ¶
type BatchLogger struct {
// contains filtered or unexported fields
}
BatchLogger accumlates log events and sends them in batches. It is safe for concurrent use.
func NewBatchLogger ¶
func NewBatchLogger(ctx context.Context, logger *Logger, uploadTicker <-chan time.Time) *BatchLogger
NewBatchLogger constructs a new BatchLogger. The supplied context will be used when logging entries supplied via the Log method. Its Close method must be called when it is no longer needed.
func (*BatchLogger) Close ¶
func (bl *BatchLogger) Close()
Close flushes any pending logs and releases any resources held by the logger. Once Close has been returned, no more retry attempts will be made. Close should be called when the logger is no longer needed.
func (*BatchLogger) Log ¶
func (bl *BatchLogger) Log(events ...*logpb.LogRequestLite_LogEventLite)
Log stages events to be logged to the eventlog service. The EventTime in each event must have been obtained from time.Now. Log returns immediately, and batches of events will be sent to the eventlog server periodically.
type Logger ¶
Logger sends event logs to the eventlog service.
func NewLogger ¶
NewLogger constructs a new Client. Users must call Close when the Client is no longer needed.
func (*Logger) LogSync ¶
LogSync synchronously logs events to the eventlog service. The EventTime in each event must have been obtained from time.Now. The returned error can be supplied to ShouldRetry to determine whether the operation should be retried.