Socket
Socket
Sign inDemoInstall

pixl-logger

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pixl-logger - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

16

logger.js

@@ -81,8 +81,8 @@ // Generic Logger Class for Node.JS

debug: function(component, level, msg, data) {
// simple debug log implementation, expects 'component', 'code' and 'msg' named columns in log
debug: function(level, msg, data) {
// simple debug log implementation, expects 'code' and 'msg' named columns in log
// only logs if level is less than or equal to current debugLevel arg
if (level <= this.args.debugLevel) {
this.print({
category: 'debug',
component: component,
code: level,

@@ -95,7 +95,6 @@ msg: msg,

error: function(component, code, msg, data) {
// simple error log implementation, expects 'component', 'code' and 'msg' named columns in log
error: function(code, msg, data) {
// simple error log implementation, expects 'code' and 'msg' named columns in log
this.print({
category: 'error',
component: component,
code: code,

@@ -107,7 +106,6 @@ msg: msg,

transaction: function(component, code, msg, data) {
// simple debug log implementation, expects 'component', 'code' and 'msg' named columns in log
transaction: function(code, msg, data) {
// simple debug log implementation, expects 'code' and 'msg' named columns in log
this.print({
category: 'transaction',
component: component,
code: code,

@@ -114,0 +112,0 @@ msg: msg,

{
"name": "pixl-logger",
"version": "1.0.0",
"version": "1.0.1",
"description": "A simple logging class which generates [bracket][delimited] log columns.",

@@ -5,0 +5,0 @@ "author": "Joseph Huckaby <jhuckaby@gmail.com>",

@@ -61,3 +61,3 @@ # Overview

```javascript
logger.debug( 'main', 1, "This won't go well\n[Hi][There]\r\nGoodbye.\n" );
logger.debug( 1, "This won't go well\n[Hi][There]\r\nGoodbye.\n" );
```

@@ -77,7 +77,7 @@

The `debug()` method is designed to assist with writing to a debug log. It automatically sets the `category` column to `debug`. It requires 3 arguments, which are values for the `component`, `code` (debug level) and `msg` columns, with the 4th argument being an optional `data` object, if you want. Examples:
The `debug()` method is designed to assist with writing to a debug log. It automatically sets the `category` column to `debug`. It requires two arguments, which are values for the `code` (debug level) and `msg` columns, with the 3rd argument being an optional `data` object, if you want. Examples:
```javascript
logger.debug( 'main', 1, "Logged at debug level 1" );
logger.debug( 'main', 2, "Logged at debug level 2", {some:"data"} );
logger.debug( 1, "Logged at debug level 1" );
logger.debug( 2, "Logged at debug level 2", {some:"data"} );
```

@@ -90,5 +90,5 @@

logger.debug( 'main', 1, "Logged at debug level 1" );
logger.debug( 'main', 2, "Logged at debug level 2" );
logger.debug( 'main', 3, "This won't be logged at all!" );
logger.debug( 1, "Logged at debug level 1" );
logger.debug( 2, "Logged at debug level 2" );
logger.debug( 3, "This won't be logged at all!" );
```

@@ -100,6 +100,6 @@

The `error()` method is designed to assist with logging errors. It automatically sets the `category` column to `error`. It requires 3 arguments, which are values for the `component`, `code` and `msg` columns, with the 4th argument being an optional `data` object, if you want. Example:
The `error()` method is designed to assist with logging errors. It automatically sets the `category` column to `error`. It requires two arguments, which are values for the `code` and `msg` columns, with the 3rd argument being an optional `data` object, if you want. Example:
```javascript
logger.error( 'main', 1005, "An error of type 1005 occurred!" );
logger.error( 1005, "An error of type 1005 occurred!" );
```

@@ -112,3 +112,2 @@

category: 'error',
component: 'main',
code: 1005,

@@ -121,6 +120,6 @@ msg: "An error of type 1005 occurred!"

The `transaction()` method is designed to assist with logging transactions. A "transaction" is whatever action you define in your app as something you want logged, for audit or replay purposes. It automatically sets the `category` column to `transaction`. It requires 3 arguments, which are values for the `component`, `code` and `msg` columns, with the 4th argument being an optional `data` object, if you want. Example:
The `transaction()` method is designed to assist with logging transactions. A "transaction" is whatever action you define in your app as something you want logged, for audit or replay purposes. It automatically sets the `category` column to `transaction`. It requires two arguments, which are values for the `code` and `msg` columns, with the 3rd argument being an optional `data` object, if you want. Example:
```javascript
logger.transaction( 'main', "user_update", "User jhuckaby was updated", {username:"jhuckaby"} );
logger.transaction( "user_update", "User jhuckaby was updated", {username:"jhuckaby"} );
```

@@ -133,3 +132,2 @@

category: 'transaction',
component: 'main',
code: "user_update",

@@ -147,3 +145,3 @@ msg: "User jhuckaby was updated",

logger.set( 'echo', true );
logger.debug( 'main', 1, "This will be logged and echoed to the console!" );
logger.debug( 1, "This will be logged and echoed to the console!" );
```

@@ -207,6 +205,2 @@

### component
The `category` column is only special in that the shortcut methods `debug()`, `error()` and `transaction()` will populate it based on the first argument passed to them.
# License

@@ -213,0 +207,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