1.0.2 • Published 4 years ago

@drorgl/node-addon-tracer v1.0.2

Weekly downloads
10
License
MIT
Repository
-
Last release
4 years ago

node addon tracer

Linux: Travis CI Build Status Windows 32/64/VS2013/VS2015: Build status

node-addon-tracer

This module solves a problem where node addons are not supplied with tracing library.

Usage

See tester.cc

Initialize the module:

tracer::Init(target);

To Log messages:

static void Log(std::string&& module, LogLevel loglevel, std::string&& message);

Inside your TypeScript code, you can attach to the logger:

import * as tracer from "tracer"
tracer.RegisterLogger(module, logLevel, message) => {
        console.log("log", module, logLevel, message);
});

Remove the logger callback:

tracer.RegisterLogger();

Flush a pending batch log messages:

tracer.Flush();

Set the maximum amount of messages that will be queued:

tracer.buffer_length = 100;

Set a logging callback batch length:

tracer.batch_length = 10;

Modify the log level for the logger:

tracer.log_level = LogLevel.DEBUG;

or test the whole addon logging works:

tracer.Log("testModule", LogLevel.DEBUG, "hello world");

License

MIT License

Copyright (c) 2016 Dror Gluska

See LICENSE file