Logging
The SDK’s built-in logger only emits warnings and errors. You can customize this with two options oncreateTimeback():
Custom logger instance. Compatible with console, Pino, Winston, Bunyan, and any logger whose
methods accept a string message followed by optional arguments.
Minimum level for the built-in logger. Ignored when a custom
logger is provided.Custom logger
Pass any logger whose methods accept a string message followed by optional arguments. The SDK prefixes each message with the internal scope, for example[timeback:handlers:user].
Log level
When using the built-in logger,logLevel controls the minimum severity:
| Level | What you see |
|---|---|
debug | Everything, including request details |
info | Operational messages and above |
warn | Warnings and errors only (default) |
error | Errors only |
silent | Nothing |
Request lifecycle hooks
Track request timing and status with theonRequestStart and onRequestEnd hooks:
| Handler | Trigger |
|---|---|
activity.submit | Activity completion |
activity.heartbeat | Time-spent heartbeat |
user.me | User profile lookup |
user.verify | User session check |
identity.signIn | SSO sign-in initiation |
identity.callback | SSO callback processing |