Skip to content

Commit 89143cf

Browse files
committed
Logging: Use console.log for prompt and template logging
Prompts can be large and they max out Winston's log size. This is a performance optimization in Winston that I don't want to override. Therefore, use a normal console.log to show the prompt if the user asks for it. Template logging has the same principles. Signed-off-by: kingbri <8082010+kingbri1@users.noreply.github.com>
1 parent b58ea0f commit 89143cf

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

bindings/bindings.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,8 @@ export class Model {
533533
}
534534

535535
if (promptTemplate) {
536-
logger.info(`Prompt template: \n${promptTemplate.rawTemplate}`);
536+
logger.info(`Prompt template:`);
537+
console.log(promptTemplate.rawTemplate);
537538
logger.info(
538539
`Using template "${promptTemplate.name}" for chat completions`,
539540
);

common/logging.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ export const logger = winston.createLogger({
4444

4545
export function logPrompt(prompt: string) {
4646
// Log prompt to console
47+
// Prompts can be very large, so make the newline log a console.log instead
4748
if (config.logging.log_prompt) {
48-
logger.info(`Prompt: \n${prompt}`);
49+
logger.info(`Prompt:`);
50+
console.log(prompt);
4951
}
5052
}
5153

0 commit comments

Comments
 (0)