
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
console-logger-dev
Advanced tools
A versatile logger for Node.js and browser environments with multiple log levels.Simple for development
A simple and flexible console logger for both Node.js and browser environments, providing different levels of logging with colored outputs.
To install the package, use the following npm command:
npm install console-logger-dev
You can create logger instances for both Node.js and React (browser) environments using the createLogger function
To create a logger instance for the Node.js environment, use the following code:
import { createLogger, EnvironmentTypes, BuildTypes } from 'console-logger-dev';
const console = createLogger(EnvironmentTypes.NODE, BuildTypes.DEVELOPMENT);
var anyObject = {
"glossary": {
"title": "example glossary"
}
};
// Log some messages using the console instance
console.info("Application started", anyObject); // Log prints in cyan color
To create a logger instance for the React (browser) environment, use the following code:
import React, { useEffect } from 'react';
import { createLogger, EnvironmentTypes, BuildTypes } from 'console-logger-dev';
const App = () => {
const console = createLogger(EnvironmentTypes.BROWSER, BuildTypes.DEVELOPMENT);
useEffect(() => {
//two parameter message and obj to print if any
browserLogger.warn('Warning message', { warning: 'Be careful' });
//here we are passing multiple params,line number, filename,message, object
console.warn('App.js', 61, 'Warning message', { warning: 'Be careful' });
console.info('App.js', 62, 'Info message', { info: 'Just so you know' });
console.debug('App.js', 63, 'Debug message', { debug: 'Debugging info' });
console.log('App.js', 64, 'Log message', { log: 'General log info' });
}, []);
return (
<div>
<h1>Check the console for log messages</h1>
</div>
);
};
export default App;
with two parameter
console.warn('Warning message', { warning: 'Be careful' });
here the obj console is the object of browser instance
with four parameter
console.warn(61,'App.js', 'Warning message', { warning: 'Be careful' });
here the obj console is the object of browser instance
Certainly! As a developer, passing all parameters manually can be awkward. That's why I've created a code snippet autofill for VSCode editor integration. Front end developers You can find it below:
The logger provides different levels of logging, each with its corresponding method:
There are two build types supported by the logger:

For ease of use, you can configure VS Code snippets for quick integration. Follow the steps below:
1.Press Ctrl + Shift + P in `VS Code
Configure User Snippets and select javascript.json{
"Import Logger": {
"prefix": "ilog",
"body": [
"import { createLogger, BuildTypes, EnvironmentTypes } from 'node-console-logger';"
],
"description": "Import statement from node-console-logger"
},
"Console Log with Details": {
"prefix": "clog",
"body": [
"console.log('${TM_FILENAME}', ${TM_LINE_NUMBER}, '${1:message}', ${2:obj});"
],
"description": "Print filename, line number, message, and object in console log"
}
}
after adding the snippet json, come to your js file and type
ilog for import statement
and clog for autofilling the filename and line number your are in :)
This project is licensed under the MIT License
FAQs
A versatile logger for Node.js and browser environments with multiple log levels.Simple for development
We found that console-logger-dev demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.