Clean up context, use it, pass metadata through to Bitdrift
This commit is contained in:
@@ -14,7 +14,12 @@ const logFunctions = {
|
||||
[LogLevel.Error]: bdError,
|
||||
} as const
|
||||
|
||||
export const bitdriftTransport: Transport = (level, _context, message) => {
|
||||
export const bitdriftTransport: Transport = (
|
||||
level,
|
||||
context,
|
||||
message,
|
||||
metadata,
|
||||
) => {
|
||||
const log = logFunctions[level]
|
||||
log('' + message)
|
||||
log(`(${context}) ${message}`, metadata)
|
||||
}
|
||||
|
||||
+15
-10
@@ -9,7 +9,8 @@ export enum LogContext {
|
||||
Default = 'logger',
|
||||
Session = 'session',
|
||||
Notifications = 'notifications',
|
||||
Convo = 'convo',
|
||||
ConversationAgent = 'conversation-agent',
|
||||
DMsAgent = 'dms-agent',
|
||||
}
|
||||
|
||||
export enum LogLevel {
|
||||
@@ -56,19 +57,23 @@ export type Metadata = {
|
||||
* @see https://github.com/getsentry/sentry-javascript/blob/903addf9a1a1534a6cb2ba3143654b918a86f6dd/packages/types/src/misc.ts#L65
|
||||
*/
|
||||
tags?: {
|
||||
[key: string]:
|
||||
| number
|
||||
| string
|
||||
| boolean
|
||||
| bigint
|
||||
| symbol
|
||||
| null
|
||||
| undefined
|
||||
[key: string]: number | string | boolean | null | undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Any additional data, passed through to Sentry as `extra` param on
|
||||
* exceptions, or the `data` param on breadcrumbs.
|
||||
*/
|
||||
[key: string]: unknown
|
||||
[key: string]: Serializable
|
||||
} & Parameters<typeof Sentry.captureException>[1]
|
||||
|
||||
export type Serializable =
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| null
|
||||
| undefined
|
||||
| Serializable[]
|
||||
| {
|
||||
[key: string]: Serializable
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import {MessagesEventBus} from '#/state/messages/events/agent'
|
||||
import {MessagesEventBusError} from '#/state/messages/events/types'
|
||||
import {DM_SERVICE_HEADERS} from '#/state/queries/messages/const'
|
||||
|
||||
const logger = Logger.create(Logger.Context.Convo)
|
||||
const logger = Logger.create(Logger.Context.ConversationAgent)
|
||||
|
||||
export function isConvoItemMessage(
|
||||
item: ConvoItem,
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
import {DM_SERVICE_HEADERS} from '#/state/queries/messages/const'
|
||||
|
||||
const LOGGER_CONTEXT = 'MessagesEventBus'
|
||||
const logger = Logger.create(Logger.Context.Convo)
|
||||
const logger = Logger.create(Logger.Context.DMsAgent)
|
||||
|
||||
export class MessagesEventBus {
|
||||
private id: string
|
||||
|
||||
Reference in New Issue
Block a user