1.0.4 • Published 12 months ago

@fra.me/native-logger v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

node-native-logger

Logging library for console and file logging based on spdlog library. Can be used for logging from the node modules (Typescript/JS) or native addons.

Table of Contents

Install for nodejs usage (Typescript/JS) Install and setup for native addons How to use addon for logging from nodejs module (Typescript/JS) How to use addon for logging from native addon

Install for nodejs usage (Typescript/JS)

Install dependency through the NPM:

npm i @fra.me/native-logger

Install and setup for native addons

Install dependency through the NPM:

npm i @fra.me/native-logger

To link with library, you need to extend binding.gyp with the following lines:

    'include_dirs': [
        '<!(node -p "require(\'@fra.me/native-logger\').include_dir")',
    ],

    'link_settings': {
        'library_dirs': [ '<!(node -p "require(\'@fra.me/native-logger\').library_dir")', ],
        'libraries': ['-llogger', 'Shlwapi']
    },

Shalwapi is required only for the Windows build

How to use addon for logging from nodejs module (Typescript/JS)

import { Logger } from '@fra.me/native-logger'

//LogLevel is optional, default level is Info
const logger = new Logger('ModuleName', [LogLevel.Debug]) 

logger.info("Message from the module X");

How to use addon for logging from native addon

#include <frame/log/Logger.h>

auto logger = log::Logger("Native Addon", log::Level::Debug);
logger.error("Log from the native addon, {} {} {}", 3.14, "Test", true);
logger.info("Info from the native addon!");
logger.warn("Warn from the native addon!");
0.0.90

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.1

1 year ago