Add file logging for errors. Add exponential backoff retry to web search. On failed web search, do not crash pipeline, return placeholder text to loanguage model
This commit is contained in:
+24
-9
@@ -1,16 +1,31 @@
|
||||
import winston from "winston";
|
||||
|
||||
const consoleFormat = winston.format.combine(
|
||||
winston.format.splat(),
|
||||
winston.format.colorize(),
|
||||
winston.format.timestamp({ format: "HH:mm:ss" }),
|
||||
winston.format.printf(({ level, message, timestamp }) => {
|
||||
return `${timestamp} ${level}: ${message}`;
|
||||
})
|
||||
);
|
||||
|
||||
const fileFormat = winston.format.combine(
|
||||
winston.format.splat(),
|
||||
winston.format.timestamp(),
|
||||
winston.format.errors({ stack: true }),
|
||||
winston.format.json()
|
||||
);
|
||||
|
||||
export const logger = winston.createLogger({
|
||||
level: "info",
|
||||
format: winston.format.combine(
|
||||
winston.format.splat(),
|
||||
winston.format.colorize(),
|
||||
winston.format.timestamp({ format: "HH:mm:ss" }),
|
||||
winston.format.printf(({ level, message, timestamp }) => {
|
||||
return `${timestamp} ${level}: ${message}`;
|
||||
})
|
||||
),
|
||||
transports: [
|
||||
new winston.transports.Console(),
|
||||
new winston.transports.Console({
|
||||
format: consoleFormat,
|
||||
}),
|
||||
new winston.transports.File({
|
||||
filename: "../data/error.jsonl",
|
||||
level: "error",
|
||||
format: fileFormat,
|
||||
}),
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user