Socket
Socket
Sign inDemoInstall

ts-log

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-log

Abstract logger TypeScript interface with a dummy logger that does nothing, useful for libraries.


Version published
Weekly downloads
2.6M
decreased by-1.39%
Maintainers
1
Weekly downloads
 
Created

What is ts-log?

The ts-log npm package provides a simple logging interface for TypeScript applications. It allows developers to create custom loggers and use them throughout their codebase. The package defines a minimal set of logging methods that can be implemented to create a logger compatible with the ts-log interface.

What are ts-log's main functionalities?

Creating a custom logger

This feature allows you to create a custom logger and use various methods like debug, info, warn, and error to log messages at different levels.

{"createLogger": "const { Logger } = require('ts-log');\nconst myLogger = new Logger();\nmyLogger.debug('This is a debug message.');\nmyLogger.info('This is an info message.');\nmyLogger.warn('This is a warning message.');\nmyLogger.error('This is an error message.');"}

Extending the logger

This feature demonstrates how to extend the Logger class to add custom logging methods such as a trace method.

{"extendLogger": "const { Logger } = require('ts-log');\nclass MyLogger extends Logger {\n  trace(message) {\n    // Custom trace method implementation\n    console.log('TRACE: ' + message);\n  }\n}\nconst myLogger = new MyLogger();\nmyLogger.trace('This is a trace message.');"}

Other packages similar to ts-log

Keywords

FAQs

Package last updated on 05 Sep 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