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

@gloxy/unilog

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@gloxy/unilog

Log everywhere with unified title and symbol.

unpublished
latest
stable
Source
npmnpm
Version
1.2.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Unilog

Log everywhere with unified title and symbol.

Install

npm install @gloxy/unilog

or

yarn add @gloxy/unilog

Usage

Constructor

import { Unilog } from '@gloxy/unilog';

const unilog = new Unilog('Play balls');
unilog.warn('Balls became worse', 3); // PRINT ⚠ Warn: Play balls. Balls become worse - 3
unilog.fail('Something wrong', { a: 1 }); // PRINT ✖ Fail: Play balls. Something wrong - { a: 1 }

Singleton

import unilog from '@gloxy/unilog';

function playBalls() {
  // Init log with a Title
  unilog('Play balls');
  try {
    unilog.info('Children are happy'); // PRINT ℹ Info: Play balls. Children are happy
    // Change title in midway temporarily (Will be consumed only once at next log action)
    unilog.mid('Break balls').warn('Balls became worse', 3); // PRINT ⚠ Warn: Break balls. Balls become worse - 3
    const sure = true;
    unilog.succeed('Balls are back to the basket.', sure); // PRINT ✔ Succeed: Play balls. Balls are back to the basket. - true
  } catch (error) {
    unilog.fail('Something wrong', error); // PRINT ✖ Fail: Play balls. Something wrong - Error...
  }
}

playBalls();
// Modify title permenantly
unilog('Finished');
unilog.info('All entertainments were closed'); // PRINT ℹ Info: Finished. All entertainments were closed

API

Constructor: new Unilog(title?) or Singleton: unilog(title?)

Create a unilog instance with or without title, which will be used as a unified title for log actions

Instance

Log actions

.info(...data?), .succeed(...data?), .warn(...data?), .fail(...data?), .debug(...data?).

data: multiple printed data passed to log actions. Data Type: Any supported type.

Logs with a unified title and symbol will be printed in the console of Browser or Node. If wanna use different title temporarily for a log action, use method .mid to set a midwayTitle before the log action. The midwayTitle will be consumed only once, which means rest log actions will still use the initialized title.

.debug won't print log if process.env.NODE_ENV === 'production'.

.getTitle

Get the present unified title

.setTitle

Set the unified title

.getMidwayTitle

Get the midway title, which temporary for next log action.

.setMidewayTitle

Set the midway title, which temporary for next log action.

.mid

Shortcut to setMidewayTitle.

Keywords

log

FAQs

Package last updated on 23 Jul 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