ixilogger v0.6.0
ixiLogger 🪵
Introduction
ixilogger is a simple to use utility that help you setup logging superfast in your Node server with Zero dependency using nodejs streams. For log rotation you can use external system like logStash. Don't forget to leave a github star ⭐, if you like ixilogger.
Installation
You can install ixilogger using below commands.
npm install --save ixilogger
or
yarn add ixilogger
How to import
If you are using require syntax then you can import using below code.
const { ixilogger } = require("ixilogger");
If you are using modern import syntax then you can import using below code.
import { ixilogger } from "ixilogger";
How to use
const path = require("path");
const { ixilogger } = require("ixilogger");
const logger = new ixilogger({
appName: "app", // Name of the application (Optional)
filePath: path.resolve("/var/log/app/", "app.log"), // Log path
});
log file path usually comes from the app config but you can also hardcode if you wanted.
config object is not mandatory and also the fields are also purely optional. So if you don't want to give any config then it uses the default "name" and "filepath".
Default parameter values name - ixilogger filePath - /var/log/ixilogger.log
Methods Available on ixilogger instance
- Trace log
logger.trace({ data: "trace log", });
- Debug log
logger.debug({ data: "debug log", });
- Info log
logger.info({ data: "info log", });
- Error log
logger.error({ data: "error log", });
Warn log
logger.warn({ data: "warn log", });
Important thing to note - Currently ixilogger only support for objects to log in all the available logger methods
There are some extra default information added with logs as per log type are
- name - Which is the name of the app given or default if not given
- logType which can have below values
- trace - debug - info - warn - error
- level which can have below values as per logType
- 10 (trace) - 20 (debug) - 30 (info) - 40 (warn) - 50 (error)
- @timestamp which store the log time
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago