Class: Logger<IsAsyncFlush>
Type parameters
Name | Type |
---|---|
IsAsyncFlush | extends 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
Name | Type |
---|---|
IsAsyncFlush | extends boolean |
Parameters
Name | Type |
---|---|
lazyMetadata | LazyValue <OrgProjectMetadata > |
logOptions | LogOptions <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
Name | Type | Description |
---|---|---|
event | Readonly <StartSpanEventArgs > | The event to log. |
options? | Object | Additional logging options |
options.allowLogConcurrentWithActiveSpan? | boolean | in 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
Name | Type |
---|---|
event | LogFeedbackFullArgs |
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
Name | Type |
---|---|
args? | StartSpanArgs |
Returns
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
Name | Type |
---|---|
callback | (span : Span ) => R |
args? | StartSpanArgs & SetCurrentArg |
Returns
PromiseUnless
<IsAsyncFlush
, R
>
Properties
kind
• kind: "logger"