New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@unic/composite-logger

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@unic/composite-logger

Lightweight logger composite to help you debug your modules and disable when you go to production

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

composite-logger

Lightweight logger composite to help you debug your modules and disable when you go to production

Installation

$ npm install @unic/composite-logger

Importing

// ES6 Module
import logger from '@unic/composite-logger';

// CommomJS
const logger = require('@unic/composite-logger').default;

Usage

Creation

// Creation of object
const obj = logger('MyPrefix'); // Exposes .log() method

// Logging stuff
window.localStorage.debug = true; // If this is falsy, nothing will be logged to the console
obj.log('Hello', 'World'); // Outputs 'MyPrefix → Hello World' to the console

API

  • logger([prefix])

logger([prefix])

Create an object with a log method.

Returns: Object - Returns an object with exposed .log() method

ParamTypeDefaultDescription
[prefix]StringIf given, provides a prefix for the logged content from the log method

Example

// Basic form
const obj = logger('MyModule');

// No prefix
const obj = logger();

// Composition
const obj = Object.assign({}, object1, object2, logger('MyModule'));

log([params...])

Log function params to console (including given prefix from creation).

Info: window.localStorage.debug must be truthy to see output in the console

Returns: undefined

ParamTypeDefaultDescription
[params...]AnyPass any number of arguments you want to log to the console

Example

// Creation
const obj = logger('MyModule');

window.localStorage.debug = true; // Enable logging to the console

obj.log('Hello', 'World', '!'); // Outputs 'MyModule → Hello World !' to the console
obj.log(1, 2, 3, 4); // Outputs 'MyModule → 1 2 3 4' to the console

Helpful Information

A composite is a function or an object which can be used as is or to merged with another object. These composites are normally used in the factory/composition pattern.

Helpful Ressources:

License

Apache-2.0

Keywords

FAQs

Package last updated on 01 Mar 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc