npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pwn-logger-lib

v1.0.7

Published

PWNLogger is a logging library for Angular(v5) project.

Downloads

26

Readme

PWNLogger

PWNLogger is a logging module for Angular(v5) project. It Provides following features.

  • Browser console logging
  • Server Logging
  • To enable logging only to a dedicated user
  • Option to control logging level

Usage

Install the package using below command

$ npm install PWNlogger --save

Import Angular Logger module to the main module(For e.g., AppModule)

import {LoggerModule} from './logger.module';

Pass configuration to initialize logger module

@NgModule ({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule, LoggerModule.forRoot ({
      serverLoggingUrl: 'http://serveraddress/modulename/v1/log',
      serverLogLevel: 'OFF',
      consoleLogLevel: 'ALL',
      httpParams: {
        'client_id': 'xxxxxxxxxxxxxxxxxxxxxx',
        'client_secret': 'xxxxxxxxxxxxxxxxxxxxxx',
        'Authorization': 'Bearer xxxxxxxxxxxxxxxxxxxxxx'
      },
      userParams: sessionStorage.getItem ('USER_LOG')
    })
    , HttpModule],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {
}

Usage

Import logger in your typescript files and call one of the logging method

import {Component} from '@angular/core';
import {RossLogger} from './logger.service';

@Component ({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
  providers: []
})

export class AppComponent {
  title = 'app';
  constructor(private logger: RossLogger) {
    this.logger.fatal ('This is a priority level 1 FATAL message...');
    this.logger.error ('This is a priority level 2 ERROR message...');
    this.logger.warn ('This is a priority level 3 WARNING message...');
    this.logger.log ('This is a priority level 4 LOG message...');
    this.logger.info ('This is a priority level 5 INFO message...');
    this.logger.debug ('This is a priority level 6 DEBUG message...');
    this.logger.trace ('This is a priority level 7 TRACE message...');
  };
}

Dependencies

Following dependencies are needed for logger module

  • @angular/common
  • @angular/core
  • @angular/http

Configuration Option

| Param Name | Allowed Values | Description | | ------ | ------ | ------ | | ConsoleLogLevel | ALL,TRACE,DEBUG,INFO,LOG,WARN,ERROR,FATAL,OFF | Only sends logs to the browser console for the level specified or higher | ServerLogLevel | ALL,TRACE,DEBUG,INFO,LOG,WARN,ERROR,FATAL,OFF | Only sends logs to the server for the level specified or higher | ServerLoggingUrl | | server URL to POST the log messages | httpParams | | Any additional HTTP Header parameter to invoke ServerLoggingUrl | userParams | ALL,TRACE,DEBUG,INFO,LOG,WARN,ERROR,FATAL,OFF |To enable logging for a dedicated user

Enable Logging to a Dedicated User

There may be a situation when a single user will be facing the issue and want to enable additional logging for that user without redeploying the application. userParams parameter makes it possible to enable this.

Add ‘USER_LOG’ as key and value as required log level to debug user issue in Google Chrome session store and refresh the user session in the same browser session

Session Storage

Open developer tools by pressing F12 (or Ctrl + Shift + i) then go to the Application tab in google chrome(storage tab in Firefox). In this tab, section expand session storage. Select your application and add key/value pair.

on OS X use: + ⌘ + i to open developer tools

In Google Chrome

N|Solid

In Firefox

N|Solid

Sample Output Format

N|Solid

Additional Details

LogLevel

ALL < TRACE < DEBUG < INFO < LOG < WARN < ERROR < FATAL < OFF

| Log Level | Description | | ------ | ------ | | ALL | The ALL has the lowest possible rank and is intended to turn on all logging. | TRACE | The TRACE Level designates fine-grained informational events than the DEBUG. | DEBUG | The DEBUG Level designates fine-grained informational events that are most useful to debug an application. | INFO | The INFO level designates informational messages that highlight the progress of the application at coarse-grained level. | LOG | The LOG Level designates information message that highlight the progress of the application at the coarse-grained level and to log exception flows. | WARN | The WARN level designates potentially harmful situations. | ERROR | The ERROR level designates error events that might still allow the application to continue running. | FATAL | The FATAL level designates very severe error events that will presumably lead the application to abort. | OFF | The OFF has the highest possible rank and is intended to turn off logging.

License

MIT

Contact Me

For any questions or concern please contact me https://programmingwithnaveen.com/contact/