Docs
SDK reference
classes
Logger

Class: Logger<IsAsyncFlush>

Type parameters

NameType
IsAsyncFlushextends boolean

Accessors

asyncFlush

get asyncFlush(): undefined | IsAsyncFlush

Returns

undefined | IsAsyncFlush


org_id

get org_id(): Promise<string>

Returns

Promise<string>


project

get project(): Promise<ObjectMetadata>

Returns

Promise<ObjectMetadata>

Constructors

constructor

new Logger<IsAsyncFlush>(lazyMetadata, logOptions?): Logger<IsAsyncFlush>

Type parameters

NameType
IsAsyncFlushextends boolean

Parameters

NameType
lazyMetadataLazyValue<OrgProjectMetadata>
logOptionsLogOptions<IsAsyncFlush>

Returns

Logger<IsAsyncFlush>

Methods

flush

flush(): Promise<void>

Returns

Promise<void>


log

log(event, options?): PromiseUnless<IsAsyncFlush, string>

Log a single event. The event will be batched and uploaded behind the scenes if logOptions.asyncFlush is true.

Parameters

NameTypeDescription
eventReadonly<StartSpanEventArgs>The event to log.
options?ObjectAdditional logging options
options.allowLogConcurrentWithActiveSpan?booleanin rare cases where you need to log at the top level separately from an active span on the logger, set this to true. :returns: The id of the logged event.

Returns

PromiseUnless<IsAsyncFlush, string>


logFeedback

logFeedback(event): void

Log feedback to an event. Feedback is used to save feedback scores, set an expected value, or add a comment.

Parameters

NameType
eventLogFeedbackFullArgs

Returns

void


startSpan

startSpan(args?): Span

Lower-level alternative to traced. This allows you to start a span yourself, and can be useful in situations where you cannot use callbacks. However, spans started with startSpan will not be marked as the "current span", so currentSpan() and traced() will be no-ops. If you want to mark a span as current, use traced instead.

See traced for full details.

Parameters

NameType
args?StartSpanArgs

Returns

Span


traced

traced<R>(callback, args?): PromiseUnless<IsAsyncFlush, R>

Create a new toplevel span underneath the logger. The name defaults to "root".

See Span.traced for full details.

Type parameters

Name
R

Parameters

NameType
callback(span: Span) => R
args?StartSpanArgs & SetCurrentArg

Returns

PromiseUnless<IsAsyncFlush, R>

Properties

kind

kind: "logger"