New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

localhost-logger

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

localhost-logger

A zero-dependency utility for logging your local network IPv4 address to the console. Useful for testing web apps on other devices.

latest
Source
npmnpm
Version
1.0.7
Version published
Maintainers
1
Created
Source

localhost-logger

A zero-dependency utility for logging your local network IPv4 address to the console. Useful for testing web apps on other devices.

Usage

CommonJS syntax


const port = 7000; // can be any number
app.listen(port, () => { // express syntax
	if (process.env.NODE_ENV !== 'production') { // NODE_ENV is usually set to 'production' on hosting platforms like Heroku.
		const localLog = require("localhost-logger"); // Require localLog here, so it won't be used in a production environment.
		localLog(port); // logs: 192.XXX.X.X:port
	}
	console.log(`Server is running on port ${port}`);
})

ES6 syntax

const port = 7000; // can be any number
app.listen(port, () => { // express syntax
	if (process.env.NODE_ENV !== 'production') { // NODE_ENV is usually set to 'production' on hosting platforms like Heroku.
		import("localhost-logger").then((localLog) => { // Import localLog here, so it won't be used in a production environment.
			localLog.default(port); // logs: 192.XXX.X.X:port
		});
	}
	console.log(`Server is running on port ${port}`);
})

Installation

Install to your devDependencies, so you won't use it on production level.

$ npm install localhost-logger --save-dev

Keywords

localhost

FAQs

Package last updated on 31 Mar 2021

Did you know?

Socket

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.

Install

Related posts