Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yalog4ts

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

yalog4ts

A log4j-like logger for ts

  • 1.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

yalog4ts

This is is yet another log4j-like logging framework for typescript. Base features:

  • named loggers
  • ability to add custom appenders
  • console interface to modify log levels at runtime

Installation

Install it with npm install --save yalog4ts.

Usage

First of all, in your app bootstrap, configure the logging system with

import { Loggerfactory, LoggerFactoryConfig } from 'yalog4ts';

[...]

Loggerfactory.init(
    window: Window, 
    storage: Storage, 
    config: LoggerFactoryConfig)

In your code, grab a logger with

const logger = LoggerFactory.getLogger('aLoggerName')

and use it, e.g.

logger.info('this is some info message');
logger.info('this is some info message', someObject);

Console interface

If enabled via configuration, yalog4ts registers some console features to set the level either globally or for certain loggers. Open the browser's developer tools, and enter lf.help to get some help (however, the context lf may be configured differently).

Basic features are:

  • lf.listloggers() or its short equivalent lf.ll() to list all registered loggers along with their log levels
  • lf.setLogLevel(loggerIndexOrName, level) or its short equivalent lf.sll() to set the log level for specific loggers, e.g. lf.sll('loggerName', lf.DEBUG) or lf.sll(1, lf.DEBUG) (index determined using lf.ll())
  • Set the overall root level e.g. lf.level = lf.DEBUG

FAQs

Package last updated on 11 Aug 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

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