MCPcopy Create free account
hub / github.com/anus-dev/ANUS / logUserPrompt

Function logUserPrompt

packages/core/src/telemetry/loggers.ts:93–114  ·  view source on GitHub ↗
(config: Config, event: UserPromptEvent)

Source from the content-addressed store, hash-verified

91}
92
93export function logUserPrompt(config: Config, event: UserPromptEvent): void {
94 ClearcutLogger.getInstance(config)?.logNewPromptEvent(event);
95 if (!isTelemetrySdkInitialized()) return;
96
97 const attributes: LogAttributes = {
98 ...getCommonAttributes(config),
99 'event.name': EVENT_USER_PROMPT,
100 'event.timestamp': new Date().toISOString(),
101 prompt_length: event.prompt_length,
102 };
103
104 if (shouldLogUserPrompts(config)) {
105 attributes['prompt'] = event.prompt;
106 }
107
108 const logger = logs.getLogger(SERVICE_NAME);
109 const logRecord: LogRecord = {
110 body: `User prompt. Length: ${event.prompt_length}.`,
111 attributes,
112 };
113 logger.emit(logRecord);
114}
115
116export function logToolCall(config: Config, event: ToolCallEvent): void {
117 const uiEvent = {

Callers 3

loggers.test.tsFile · 0.85
mainFunction · 0.85
useAnusStreamFunction · 0.85

Calls 5

shouldLogUserPromptsFunction · 0.85
logNewPromptEventMethod · 0.80
getCommonAttributesFunction · 0.70
getInstanceMethod · 0.45

Tested by

no test coverage detected