Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Latest commit

 

History

History
26 lines (19 loc) · 681 Bytes

README.md

File metadata and controls

26 lines (19 loc) · 681 Bytes

Warning

mongodb-log-writer is now being maintained in the devtools-shared repository. Please check there for updates.

mongodb-log-writer

A library for writing MongoDB logv2 messages.

import { MongoLogManager, mongoLogId } from 'mongodb-log-writer';

const manager = new MongoLogManager({
  directory: os.homedir() + '/.app-logs',
  retentionDays: 30,
  onwarn: console.warn,
  onerror: console.error,
  gzip: true
});
await manager.cleanupOldLogfiles();

const writer = manager.createLogWriter();
writer.info('component', mongoLogId(12345), 'context', 'message', { foo: 'bar' });

LICENSE

Apache-2.0