TypeScript class storing job lifecycle logs in MongoDB, with indexing and query helpers.
// Source: https://github.com/agenda/agenda | License: MIT | Copyright 2013 Ryan Schmukler <ryan@slingingcode.com>
// Provided via justclaw.it.com; keep this notice with the code.
import debug from 'debug';
import type { Collection, Db, Filter, Sort } from 'mongodb';
import type { JobLogger, JobLogEntry, JobLogQuery, JobLogQueryResult, LogLevel, JobLogEvent } from 'agenda';
const log = debug('agenda:mongo:logger');
/**
* MongoDB implementation of JobLogger.
* Stores job lifecycle events in a dedicated MongoDB collection.
*
* @example
* ```typescript
* // Via backend (automatic connection sharing):
* import { MongoBackend } from '@agendajs/mongo-backend';
*
* const backend = new MongoBackend({
* mongo: db,
* logging: true // enables MongoJobLogger with 'agenda_logs' collect
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key