The main class for initializing and configuring Node Telescope.
constructor(options: TelescopeOptions)storage: StorageInterface- The storage implementation to use (e.g., MongoStorage)watchedEntries: EntryType[]- Array of entry types to watch (default: [REQUESTS, EXCEPTIONS, QUERIES])enableQueryLogging: boolean- Whether to enable query logging (default: false)corsOptions: object- CORS options for Telescope routesapp: Express- Express application instanceserver: HttpServer- HTTP server instanceenableFileReading: boolean- Whether to enable file reading for exceptions (default: false)fileReadingEnvironments: string[]- Environments where file reading is enabled (default: ['development'])includeCurlCommand: boolean- Whether to include CURL commands in request logs (default: false)recordMemoryUsage: boolean- Whether to record memory usage (default: false)databaseType: TelescopeDatabaseType- Type of database being used (MONGO or POSTGRES)responseBodySizeLimit: number- Maximum size of response body to log (default: 2000)queryResultSizeLimit: number- Maximum size of query result to log (default: 2000)
Returns the Express middleware for Telescope.
middleware(): express.RequestHandlerLogs an exception to Telescope.
logException(error: Error | unknown): voidConnects to the storage backend.
connect(): Promise<void>Interface for implementing custom storage backends.
connect(): Promise<void>storeEntry(entry: Omit<Entry, 'id'>): Promise<string>getEntry(id: string): Promise<Entry | null>getEntries(queryOptions: AdvancedQueryOptions): Promise<{ entries: Entry[]; pagination: unknown }>getRecentEntries(limit: number, type?: EntryType): Promise<Entry[]>prune(maxAge: number): Promise<void>
Enum for different types of entries that can be logged.
enum EntryType {
REQUESTS = 'requests',
EXCEPTIONS = 'exceptions',
QUERIES = 'queries',
}Enum for supported database types.
enum TelescopeDatabaseType {
MONGO = 'mongo',
POSTGRES = 'postgres',
MYSQL = 'mysql',
}For more detailed information on each component and advanced usage, please refer to the source code and inline documentation.