Log all leveldb operations.
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();
$ npm install level-log
Start tracking db
. Options:
sublevel (Boolean)
: look into sublevels as well
On every operation, call fn
with
- method name
- array of arguments
- the stream, if one was created
On every call to method
, call fn
with
- array of arguments
- the stream, if one was created
MIT