Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var assert = require('assert');
var cls = require('continuation-local-storage');
var Logger = require('bunyan');
var logger = new Logger({
name : 'test2',
stream : process.stdout,
level : 'trace'
});
logger.debug("This causes problems later.");
var test2 = cls.createNamespace("test2");
assert.ok(!test2.get('state'), "state should not yet be visible");
test2.run(function () {
test2.set('state', true);
assert.ok(test2.get('state'), "state should be visible");
setTimeout(
function () { assert.ok(test2.get('state'), "state should be visible"); },
100 // timeout is important for some reason
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.