Files
speckle-server/packages/server/observability/domain/fields.ts
T
Iain Sproat 9308fa82b4 chore(server/observability): logging of gatekeeper/rest/billing (#4066)
* chore(server/observability): logging of gatekeeper/rest/billing

* Rename logged field

* use logWithErr, operationStatus, and operationName
- clean up logging

* Fix bad merge from main

* Use a wrapper to log

* Include mutation resolvers

* Fix per PR comments
2025-04-11 15:27:52 +02:00

37 lines
717 B
TypeScript

/**
* Helper constants for log fields.
*/
/**
* Operation status values.
* Intended to be used with the `operationStatus` field when logging.
* Helps to avoid typos and ensure consistency.
*/
const STATUS = {
START: 'start',
SUCCESS: 'success',
FAILURE: 'failure'
} as const
export const OperationStatus = {
start: {
operationStatus: STATUS.START
},
success: {
operationStatus: STATUS.SUCCESS
},
failure: {
operationStatus: STATUS.FAILURE
}
} as const
export const OperationName = (name: string) => ({
operationName: name
})
export const stripeEventId = (id: string) => ({
stripeEventId: id
})
export const OperationLogLinePrefix = '[{operationName} ({operationStatus})]'