0.5.1 • Published 7 years ago

pwlogger v0.5.1

Weekly downloads
6
License
SEE LICENSE IN LI...
Repository
github
Last release
7 years ago

pwDB Logger

pwDB Logger is a logger that writes object and JSON messages to a datafile readable by pwDB, with minimal RAM footprint since it doesn't keep a cache of the database in memory. Use it when your application doesn't need to use the database capabilities of pwDB, just the logging features. You can then use pwDB to query and modify your database.

The API and implementation interface replicates Fluentd's node logger (https://github.com/fluent/fluent-logger-node). This provides the ability to migrate with minimum impact and changes.

API

var Logger = require('pwDB-logger')
  , logger = new Logger({ filename: "path/to/datafile" });

logger.insert({ hello: "world", number: 42, timestamp: new Date() }, function (err) {
  // err will not be null if the object is not well formatted for pwDB
  // meaning one of the keys contains a dot or begins with a dollar sign
});

// You can insert arrays of documents
// The callback is optional
logger.insert([{ planet: "earth" }, { planet: "Mars" }]);

License

See License

Open Source used in this product

See LICENSES

Special Thank You!

nedb-logger - Launched this works and provided inspiration (https://github.com/louischatriot/nedb-logger) fluentd & fluent-logger for Node.js - API and interface (https://github.com/fluent/fluent-logger-node)