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

mongodb-js/mongodb-log-writer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A library for writing MongoDB logv2 messages

Resources

License

Stars

Watchers

Forks

Packages

No packages published