Skip to content

Latest commit

 

History

History
66 lines (42 loc) · 1.1 KB

README.md

File metadata and controls

66 lines (42 loc) · 1.1 KB

level-log

Log all leveldb operations.

build status

Example

var level = require('level');
var log = require('level-log');

var db = level('db');
var events = log(db);

events.on('op', function(name, args, stream){
  console.log(name, args, !!stream);
  // => "put" ["foo", "bar", function()] false
  // => "get" ["foo", function()] false
  // => "createReadStream" [] true
});

events.on('createReadStream', function(args, stream){
  // ...
});

db.put('foo', 'bar', function(){
  db.get('foo', function(){});
});

db.createReadStream();

Installation

$ npm install level-log

API

var events = log(db[, opts])

Start tracking db. Options:

  • sublevel (Boolean): look into sublevels as well

events.on('op', fn)

On every operation, call fn with

  • method name
  • array of arguments
  • the stream, if one was created

events.on(method, fn)

On every call to method, call fn with

  • array of arguments
  • the stream, if one was created

License

MIT