ReferenceSDKTypescriptClassesLogger

Class: Logger<IsAsyncFlush>

Type parameters

NameType
IsAsyncFlushextends boolean

Accessors

asyncFlush

get asyncFlush(): undefined | IsAsyncFlush

Returns

undefined | IsAsyncFlush


id

get id(): Promise<string>

Returns

Promise<string>


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

export

export(): Promise<string>

Return a serialized representation of the logger that can be used to start subspans in other places. See Span.start_span for more details.

Returns

Promise<string>


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.allowConcurrentWithSpans?booleanin rare cases where you need to log at the top level separately from spans on the logger elsewhere, 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"