Package Exports
- coralogix-logger
- coralogix-logger/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (coralogix-logger) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Coralogix Node.js SDK
Use coralogix-logger to easily send your logs to Coralogix's log analytics platform.
Table of Content
Prerequisites
Before beginning you must have installed:
- Node.js
- npm
Installation
npm install --save coralogix-logger
Usage
JavaScript
var Coralogix = require("coralogix-logger");
// global confing for application name, private key, subsystem name
const config = new Coralogix.LoggerConfig({
applicationName: "node tester",
privateKey: "YOUR_PRIVATE_KEY",
subsystemName: "node tester sub",
});
Coralogix.CoralogixLogger.configure(config);
// create a new logger with category
const logger = new Coralogix.CoralogixLogger("My Category");
// create a log
const log = new Coralogix.Log({
severity: Coralogix.Severity.info,
className: "className",
methodName: "methodName",
text: "log data",
})
// send log to coralogix
logger.addLog(log);
TypeScript
For using TypeScript sources you should clone this repository, because it's not included in npm distribution.
import {Log, Severity, CoralogixLogger, LoggerConfig} from "coralogix-logger";
// global confing for application name, private key, subsystem name
const config = new LoggerConfig({
applicationName: "node tester",
privateKey: "YOUR_PRIVATE_KEY",
subsystemName: "node tester sub",
});
CoralogixLogger.configure(config);
// create a new logger with category
logger: CoralogixLogger = new CoralogixLogger("My Category")
// create a log
const log = new Log({
severity: Severity.info,
className: "className",
methodName: "methodName",
text: "log data",
})
// send log to coralogix
logger.addLog(log);