New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rfx-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

rfx-logger - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

esm2015/lib/rfx-logger.interceptor.js

35

bundles/rfx-logger.umd.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http')) :
typeof define === 'function' && define.amd ? define('rfx-logger', ['exports', '@angular/core', '@angular/common/http'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['rfx-logger'] = {}, global.ng.core, global.ng.common.http));
}(this, (function (exports, i0, http) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common/http'), require('rxjs'), require('rxjs/operators')) :
typeof define === 'function' && define.amd ? define('rfx-logger', ['exports', '@angular/core', '@angular/common/http', 'rxjs', 'rxjs/operators'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['rfx-logger'] = {}, global.ng.core, global.ng.common.http, global.rxjs, global.rxjs.operators));
}(this, (function (exports, i0, http, rxjs, operators) { 'use strict';

@@ -50,2 +50,28 @@ var ConfigurationModel = /** @class */ (function () {

var RfxLoggerInterceptor = /** @class */ (function () {
function RfxLoggerInterceptor(rfxLoggerService) {
this.rfxLoggerService = rfxLoggerService;
}
RfxLoggerInterceptor.prototype.intercept = function (request, next) {
var _this = this;
return next.handle(request).pipe(operators.tap(function (event) {
if (event instanceof http.HttpResponse) {
_this.rfxLoggerService.success(request.url, event);
}
}), operators.catchError(function (error) {
if (error instanceof http.HttpErrorResponse) {
_this.rfxLoggerService.error(request.url, error);
}
return rxjs.throwError(error);
}));
};
return RfxLoggerInterceptor;
}());
RfxLoggerInterceptor.decorators = [
{ type: i0.Injectable }
];
RfxLoggerInterceptor.ctorParameters = function () { return [
{ type: RfxLoggerService }
]; };
var RfxLoggerModule = /** @class */ (function () {

@@ -83,2 +109,3 @@ function RfxLoggerModule() {

exports.ConfigurationModel = ConfigurationModel;
exports.RfxLoggerInterceptor = RfxLoggerInterceptor;
exports.RfxLoggerModule = RfxLoggerModule;

@@ -85,0 +112,0 @@ exports.RfxLoggerService = RfxLoggerService;

2

bundles/rfx-logger.umd.min.js

@@ -1,2 +0,2 @@

!function(o,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common/http")):"function"==typeof define&&define.amd?define("rfx-logger",["exports","@angular/core","@angular/common/http"],e):e((o="undefined"!=typeof globalThis?globalThis:o||self)["rfx-logger"]={},o.ng.core,o.ng.common.http)}(this,(function(o,e,r){"use strict";var n=function(){},t=function(){function o(o){this.showDebugInfo=!(null==o?void 0:o.disableDebug),this.successCss="color: #8BC34A; font-weight: bold; padding: 1px 0;",this.successCssTag="color: #000000; font-weight: bold; background-color: #8BC34A; padding: 1px 5px;",this.warningCss="color: #FFC107; font-weight: bold; padding: 1px 0;",this.warningCssTag="color: #000000; font-weight: bold; background-color: #FFC107; padding: 1px 5px;",this.errorCss="color: #F44336; font-weight: bold; padding: 1px 0;",this.errorCssTag="color: #FFFFFF; font-weight: bold; background-color: #F44336; padding: 1px 5px;"}return o.prototype.success=function(o,e){var n=e instanceof r.HttpResponse,t=n&&(null==e?void 0:e.status)?" "+e.status+" ":"SUCCESS",s=n&&(null==e?void 0:e.body)?e.body:e;console.log("%c "+t+" %c "+o,this.successCssTag,this.successCss,this.showDebugInfo&&s?Array(s):"")},o.prototype.warning=function(o,e){console.log("%cWARNING%c "+o,this.warningCssTag,this.warningCss,this.showDebugInfo&&e?Array(e):"")},o.prototype.error=function(o,e){var n=e instanceof r.HttpErrorResponse,t=n&&(null==e?void 0:e.status)?" "+e.status+" ":"ERROR",s=n&&(null==e?void 0:e.error)?e.error:e;console.log("%c "+t+" %c "+o,this.errorCssTag,this.errorCss,this.showDebugInfo&&s?Array(s):"")},o}();t.ɵprov=e.ɵɵdefineInjectable({factory:function(){return new t(e.ɵɵinject(n,8))},token:t,providedIn:"root"}),t.decorators=[{type:e.Injectable,args:[{providedIn:"root"}]}],t.ctorParameters=function(){return[{type:n,decorators:[{type:e.Optional}]}]};var s=function(){function o(){}return o.config=function(e){return{ngModule:o,providers:[{provide:n,useValue:e}]}},o}();s.decorators=[{type:e.NgModule,args:[{imports:[],exports:[]}]}],o.ConfigurationModel=n,o.RfxLoggerModule=s,o.RfxLoggerService=t,Object.defineProperty(o,"__esModule",{value:!0})}));
!function(o,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("@angular/core"),require("@angular/common/http"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("rfx-logger",["exports","@angular/core","@angular/common/http","rxjs","rxjs/operators"],r):r((o="undefined"!=typeof globalThis?globalThis:o||self)["rfx-logger"]={},o.ng.core,o.ng.common.http,o.rxjs,o.rxjs.operators)}(this,(function(o,r,e,t,n){"use strict";var s=function(){},i=function(){function o(o){this.showDebugInfo=!(null==o?void 0:o.disableDebug),this.successCss="color: #8BC34A; font-weight: bold; padding: 1px 0;",this.successCssTag="color: #000000; font-weight: bold; background-color: #8BC34A; padding: 1px 5px;",this.warningCss="color: #FFC107; font-weight: bold; padding: 1px 0;",this.warningCssTag="color: #000000; font-weight: bold; background-color: #FFC107; padding: 1px 5px;",this.errorCss="color: #F44336; font-weight: bold; padding: 1px 0;",this.errorCssTag="color: #FFFFFF; font-weight: bold; background-color: #F44336; padding: 1px 5px;"}return o.prototype.success=function(o,r){var t=r instanceof e.HttpResponse,n=t&&(null==r?void 0:r.status)?" "+r.status+" ":"SUCCESS",s=t&&(null==r?void 0:r.body)?r.body:r;console.log("%c "+n+" %c "+o,this.successCssTag,this.successCss,this.showDebugInfo&&s?Array(s):"")},o.prototype.warning=function(o,r){console.log("%cWARNING%c "+o,this.warningCssTag,this.warningCss,this.showDebugInfo&&r?Array(r):"")},o.prototype.error=function(o,r){var t=r instanceof e.HttpErrorResponse,n=t&&(null==r?void 0:r.status)?" "+r.status+" ":"ERROR",s=t&&(null==r?void 0:r.error)?r.error:r;console.log("%c "+n+" %c "+o,this.errorCssTag,this.errorCss,this.showDebugInfo&&s?Array(s):"")},o}();i.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new i(r.ɵɵinject(s,8))},token:i,providedIn:"root"}),i.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],i.ctorParameters=function(){return[{type:s,decorators:[{type:r.Optional}]}]};var c=function(){function o(o){this.rfxLoggerService=o}return o.prototype.intercept=function(o,r){var s=this;return r.handle(o).pipe(n.tap((function(r){r instanceof e.HttpResponse&&s.rfxLoggerService.success(o.url,r)})),n.catchError((function(r){return r instanceof e.HttpErrorResponse&&s.rfxLoggerService.error(o.url,r),t.throwError(r)})))},o}();c.decorators=[{type:r.Injectable}],c.ctorParameters=function(){return[{type:i}]};var u=function(){function o(){}return o.config=function(r){return{ngModule:o,providers:[{provide:s,useValue:r}]}},o}();u.decorators=[{type:r.NgModule,args:[{imports:[],exports:[]}]}],o.ConfigurationModel=s,o.RfxLoggerInterceptor=c,o.RfxLoggerModule=u,o.RfxLoggerService=i,Object.defineProperty(o,"__esModule",{value:!0})}));
//# sourceMappingURL=rfx-logger.umd.min.js.map
/*
* Public API Surface of rfx-logger
*/
export * from './lib/configuration.model';
export * from './lib/rfx-logger.interceptor';
export * from './lib/rfx-logger.service';
export * from './lib/rfx-logger.module';
export * from './lib/configuration.model';
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL3JmeC1sb2dnZXIvc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLDBCQUEwQixDQUFDO0FBQ3pDLGNBQWMseUJBQXlCLENBQUM7QUFDeEMsY0FBYywyQkFBMkIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXHJcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiByZngtbG9nZ2VyXHJcbiAqL1xyXG5cclxuZXhwb3J0ICogZnJvbSAnLi9saWIvcmZ4LWxvZ2dlci5zZXJ2aWNlJztcclxuZXhwb3J0ICogZnJvbSAnLi9saWIvcmZ4LWxvZ2dlci5tb2R1bGUnO1xyXG5leHBvcnQgKiBmcm9tICcuL2xpYi9jb25maWd1cmF0aW9uLm1vZGVsJztcclxuIl19
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL3JmeC1sb2dnZXIvc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLDJCQUEyQixDQUFDO0FBQzFDLGNBQWMsOEJBQThCLENBQUM7QUFDN0MsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLHlCQUF5QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcclxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIHJmeC1sb2dnZXJcclxuICovXHJcblxyXG5leHBvcnQgKiBmcm9tICcuL2xpYi9jb25maWd1cmF0aW9uLm1vZGVsJztcclxuZXhwb3J0ICogZnJvbSAnLi9saWIvcmZ4LWxvZ2dlci5pbnRlcmNlcHRvcic7XHJcbmV4cG9ydCAqIGZyb20gJy4vbGliL3JmeC1sb2dnZXIuc2VydmljZSc7XHJcbmV4cG9ydCAqIGZyb20gJy4vbGliL3JmeC1sb2dnZXIubW9kdWxlJztcclxuIl19
import { ɵɵdefineInjectable, ɵɵinject, Injectable, Optional, NgModule } from '@angular/core';
import { HttpResponse, HttpErrorResponse } from '@angular/common/http';
import { throwError } from 'rxjs';
import { tap, catchError } from 'rxjs/operators';

@@ -43,2 +45,26 @@ class ConfigurationModel {

class RfxLoggerInterceptor {
constructor(rfxLoggerService) {
this.rfxLoggerService = rfxLoggerService;
}
intercept(request, next) {
return next.handle(request).pipe(tap(event => {
if (event instanceof HttpResponse) {
this.rfxLoggerService.success(request.url, event);
}
}), catchError(error => {
if (error instanceof HttpErrorResponse) {
this.rfxLoggerService.error(request.url, error);
}
return throwError(error);
}));
}
}
RfxLoggerInterceptor.decorators = [
{ type: Injectable }
];
RfxLoggerInterceptor.ctorParameters = () => [
{ type: RfxLoggerService }
];
class RfxLoggerModule {

@@ -72,3 +98,3 @@ static config(configuration) {

export { ConfigurationModel, RfxLoggerModule, RfxLoggerService };
export { ConfigurationModel, RfxLoggerInterceptor, RfxLoggerModule, RfxLoggerService };
//# sourceMappingURL=rfx-logger.js.map
{
"name": "rfx-logger",
"version": "1.1.0",
"description": "RfxLogger - an upgrade for your console messages",
"version": "2.0.0",
"description": "RfxLogger - an upgrade for your browser console messages",
"author": "RedFoxxo",
"repository": {
"type": "git",
"url": "https://github.com/RedFoxxo/RFXLibrary.git"
"url": "https://github.com/RedFoxxo/RFXLibrary/tree/master/projects/rfx-logger"
},

@@ -20,3 +20,6 @@ "bugs": {

"console",
"logging"
"logging",
"browser",
"interceptor",
"api"
],

@@ -23,0 +26,0 @@ "license": "MIT",

@@ -0,4 +1,5 @@

export * from './lib/configuration.model';
export * from './lib/rfx-logger.interceptor';
export * from './lib/rfx-logger.service';
export * from './lib/rfx-logger.module';
export * from './lib/configuration.model';
//# sourceMappingURL=public-api.d.ts.map
# RfxLogger
An upgrade for your console messages
An upgrade for your browser console messages
![alt text](https://i.ibb.co/y59MBfV/rfx-logger-1.png)
<img src="https://i.ibb.co/y59MBfV/rfx-logger-1.png" width="350" />
<img src="https://i.ibb.co/6wZcg0x/rfx-http-logger.png" width="350" />

@@ -12,2 +13,3 @@ ## Features

- Message tag supports HTTP codes
- Intercept HTTP calls and automatically prints message to the console

@@ -21,14 +23,23 @@ ## Installation

Import module:
### Import module and interceptor:
`config` is optional if you want to disable debug data. Default is `false`
- __interceptor__ is optional
- `.config` is optional if you want to disable debug data (useful for production). Default is `false`
```typescript
import { RfxLoggerModule } from 'rfx-logger';
import { RfxLoggerModule, RfxLoggerInterceptor } from 'rfx-logger';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
@NgModule({
imports: [
RfxLoggerModule.config({
disableDebug: true // true = disabled debug data (useful for production)
})
]
imports: [
RfxLoggerModule.config({
disableDebug: true
})
],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: RfxLoggerInterceptor,
multi: true
}
],
})

@@ -39,22 +50,21 @@ ```

* __message__
custom string *(eg. function name)*
* __data__
optional, any object you want to print with the debug message *(eg. backend data)*
```typescript
import { RfxLoggerService } from 'rfx-logger';
import { RfxLoggerService } from 'rfx-logger';
[...]
[...]
constructor(rfxLoggerService: RfxLoggerService) { }
constructor(rfxLoggerService: RfxLoggerService) { }
[...]
[...]
this.rfxLoggerService.success(title, data); // success - green message
this.rfxLoggerService.warning(title, data); // warning - yellow message
this.rfxLoggerService.error(title, data); // error - red message
this.rfxLoggerService.success(message, data); // success - green message
this.rfxLoggerService.warning(message, data); // warning - yellow message
this.rfxLoggerService.error(message, data); // error - red message
```
* __title__
custom string *(eg. function name)*
* __data__
optional, any object you want to print with the debug message *(eg. backend data)*
## Demo

@@ -61,0 +71,0 @@

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":4,"metadata":{"RfxLoggerService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":4,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":16,"character":15}}]],"parameters":[{"__symbolic":"reference","name":"ConfigurationModel"}]}],"success":[{"__symbolic":"method"}],"warning":[{"__symbolic":"method"}],"error":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"RfxLoggerModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":3,"character":1},"arguments":[{"imports":[],"exports":[]}]}],"members":{},"statics":{"config":{"__symbolic":"function","parameters":["configuration"],"value":{"ngModule":{"__symbolic":"reference","name":"RfxLoggerModule"},"providers":[{"provide":{"__symbolic":"reference","name":"ConfigurationModel"},"useValue":{"__symbolic":"reference","name":"configuration"}}]}}}},"ConfigurationModel":{"__symbolic":"class","members":{}}},"origins":{"RfxLoggerService":"./lib/rfx-logger.service","RfxLoggerModule":"./lib/rfx-logger.module","ConfigurationModel":"./lib/configuration.model"},"importAs":"rfx-logger"}
{"__symbolic":"module","version":4,"metadata":{"ConfigurationModel":{"__symbolic":"class","members":{}},"RfxLoggerInterceptor":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":13,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"RfxLoggerService"}]}],"intercept":[{"__symbolic":"method"}]}},"RfxLoggerService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":4,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":16,"character":15}}]],"parameters":[{"__symbolic":"reference","name":"ConfigurationModel"}]}],"success":[{"__symbolic":"method"}],"warning":[{"__symbolic":"method"}],"error":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"RfxLoggerModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":3,"character":1},"arguments":[{"imports":[],"exports":[]}]}],"members":{},"statics":{"config":{"__symbolic":"function","parameters":["configuration"],"value":{"ngModule":{"__symbolic":"reference","name":"RfxLoggerModule"},"providers":[{"provide":{"__symbolic":"reference","name":"ConfigurationModel"},"useValue":{"__symbolic":"reference","name":"configuration"}}]}}}}},"origins":{"ConfigurationModel":"./lib/configuration.model","RfxLoggerInterceptor":"./lib/rfx-logger.interceptor","RfxLoggerService":"./lib/rfx-logger.service","RfxLoggerModule":"./lib/rfx-logger.module"},"importAs":"rfx-logger"}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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