
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
w-tiny-logger
Advanced tools
An easy-to-use logger to implement on your NodeJs App. It implements winston logger.
const logger = require("w-tiny-logger").getLogger()
logger.info("Hi there, my first log!")
This example will just log on your console.
If you want to log information on a log file, you can try the next example:
const logger = require("w-tiny-logger").getLogger({
File: {}
})
logger.info("Hi there, my first file log!")
You can log string messages, or maybe JSON metadata objects.
const logger = require("w-tiny-logger").getLogger({})
logger.info("Logging my JSON!", { myObject: "This is my JSON Metadata object" })
logger.warn("Logging my JSON!", { whatever: "This is my warn" })
You can use different levels for logging.
const logger = require("w-tiny-logger").getLogger({})
logger.log('info', "Info log");
logger.log('warn', "Warn log");
logger.log('error', "Error log");
logger.info("Info log by method call");
logger.warn("Warn log by method call");
logger.error("Error log by method call");
It´s possible to use MongoDB or Graylog aswell. Or maybe you want to use all of them together.
const logger = require("w-tiny-logger").getLogger({
File: {
filename: "MyLog" //optional
},
MongoDB: { db: "mongodb://127.0.0.1"},
Graylog: {}
})
logger.info("Using many transports at the same time!")
It´s default the use of the Console Transport, but any other is optional.
This module is an implementation of the Winston Logger Library, using some of the basic transports available for the library, like Winston Graylog2 and and Winston MongoDB.
You can find more information about the options for each transport on the authors library.
It´s possible to implement other transports, just like using winston.
const assert = require("assert")
const winston = require('winston');
const sinon = require('sinon');
const spyLogger = require('winston-spy');
const spy = sinon.spy();
const logger = require("w-tiny-logger").getLogger({
File: {
filename: "MyLog" //optional
},
MongoDB: {
level: 'info',
silent: false,
db: "mongodb://127.0.0.1",
options: { poolSize: 2, autoReconnect: true },
collection: 'log',
storeHost: false,
username: '',
password: '',
label: '',
name: '',
capped: false,
cappedSize: 10000000,
cappedMax: 10000000,
tryReconnect: false,
decolorize: false,
expireAfterSeconds: 10000
},
Graylog: {
name: 'Graylog',
level: 'debug',
silent: false,
handleExceptions: false,
prelog: function(msg) {
return msg.trim();
},
graylog: {
servers: [{host: 'localhost', port: 12201}, {host: 'remote.host', port: 12201}],
hostname: 'myServer',
facility: 'myAwesomeApp',
bufferSize: 1400
},
staticMeta: {env: 'staging'}
}
}, [new spyLogger({ spy: spy })])
let message = "Using many transports at the same time!"
logger.info(message)
assert(spy.calledWith('info', message));
FAQs
Small and simple logger for Node.JS Apps. Implementing winston.
We found that w-tiny-logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.