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

@jalik/logger

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jalik/logger - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

3

CHANGELOG.md
# Changelog
## v2.0.1
- Fixes example of `Logger.on(String, Function)` in README
## v2.0.0

@@ -4,0 +7,0 @@ - **BREAKING:** Method `Logger.on(String, Function)` has changed to improve ease of use. Before you had to pass

2

package.json
{
"name": "@jalik/logger",
"version": "2.0.0",
"version": "2.0.1",
"description": "A logging utility to log messages to anywhere.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -78,14 +78,18 @@ # Logger

logger.error('Forbidden', {error: new Error('forbidden')});
// You can directly pass an Error object
logger.error(new Error('forbidden'));
// Logs an info message
logger.info('Application started', {date: new Date()});
logger.info('Application started', {
date: new Date()
});
// Logs a warning message
logger.warn('Disk usage is above 90%', {diskUsage: 92.6});
logger.warn('Disk usage is above 90%', {
diskUsage: 92.6
});
// Logs a custom type message
const ipAddress = '6.6.6.6';
logger.log(`The IP address ${ipAddress} has failed to login 3 times in one minute`, 'suspicious',
{ipAddress});
logger.log(`The IP address ${ipAddress} has failed to login 3 times`, 'suspicious', {ipAddress});
```

@@ -120,9 +124,13 @@

// With this event listener, you can do something when an error happens
logger.on(Types.error, (message, context) => {
logger.on('log', (message, type, context) => {
if (type === Types.error) {
// do whatever you want here...
// save error to database, send an email...
}
});
// This will trigger the listener defined above
logger.error('Cannot contact DNS server', {ipAddress: '8.8.8.8'});
logger.error('Cannot contact DNS server', {
ipAddress: '8.8.8.8'
});
```

@@ -129,0 +137,0 @@

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