Node Addon Tracer
npm install @drorgl/node-addon-tracerThis module solves a problem where node addons are not supplied with tracing library.
Initialize the module:
``C++`
tracer::Init(target);
To Log messages:
`C++`
static void Log(std::string&& module, LogLevel loglevel, std::string&& message);
Inside your TypeScript code, you can attach to the logger:
`typescript`
import * as tracer from "tracer"
tracer.RegisterLogger(module, logLevel, message) => {
console.log("log", module, logLevel, message);
});
Remove the logger callback:
`typescript`
tracer.RegisterLogger();
Flush a pending batch log messages:
`typescript`
tracer.Flush();
Set the maximum amount of messages that will be queued:
`typescript`
tracer.buffer_length = 100;
Set a logging callback batch length:
`typescript`
tracer.batch_length = 10;
Modify the log level for the logger:
`typescript`
tracer.log_level = LogLevel.DEBUG;
or test the whole addon logging works:
`typescript``
tracer.Log("testModule", LogLevel.DEBUG, "hello world");
Copyright (c) 2016 Dror Gluska
See LICENSE file