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

@gauntface/logger

Package Overview
Dependencies
Maintainers
1
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gauntface/logger

A simple console abstraction with some little extras

  • 3.0.3
  • npm
  • Socket score

Version published
Weekly downloads
418
increased by73.44%
Maintainers
1
Weekly downloads
 
Created
Source

@hopin/logger

Build and Publish Status

`@gauntface/logger` is a simple library aimed at making it easy to add colored and prefixed logs to a project in both Node and the browser.

Usage in Browser

<script src="https://unpkg.com/@gauntface/logger@3.0.2/build/browser-globals.js"></script>
<script>
  console.log('\n\nThe following are the logs out of the box:\n\n\n');

  // Use the default logger
  gauntface.logger.debug(`console.debug()`);
  gauntface.logger.info(`console.info()`);
  gauntface.logger.log(`console.log()`);
  gauntface.logger.warn(`console.warn()`);
  gauntface.logger.error(`console.error()`);

  console.log('\n\nYou can customize the prefix to something you\'ll recognize:\n\n\n');

  // Customize the default loggers prefix
  gauntface.logger.setPrefix(`Logger Demo`);
  gauntface.logger.log('👋');

  // Create your own logger instances
  console.log('\n\nYou can create different instances of "Loggers":\n\n\n');

  const simpleLogger = new gauntface.Logger({
    prefix: 'My App/Demo',
  });
  simpleLogger.log(`Example message`, {
    message: 'Works just like console.log()'
  });

  console.log('\n\nYou can also customize each log level prefix:\n\n\n')

  // Use your own prefix for some or all of the log
  // levels
  const complexLogger = new gauntface.Logger({
    prefix: {
      [gauntface.LogLevels.GROUP]: 'My App/Groups',
      [gauntface.LogLevels.ERROR]: '👻',
    },
  });
  complexLogger.log('The logger lib supports groups');
  complexLogger.group(`Like this one`);
  complexLogger.log(`I'm nested`);
  complexLogger.groupCollapsed(`You can collapse them too`);
  complexLogger.error(`Boo`);
  complexLogger.groupEnd();
  complexLogger.groupEnd();
</script>

Usage in Node

const {Logger} = require('@hopin/logger');

const example1Logger = new Logger({
  prefix: 'Example 1',
});
const example2Logger = new Logger({
  prefix: 'Example 2',
});

example1Logger.debug('Hello Logger 2 *waves*');
example2Logger.log('Oh Hai!');

Keywords

FAQs

Package last updated on 06 Jul 2022

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