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

@iamadamjowett/angular-logger-max

v1.2.3

Published

A custom logger for angular with color coding (in Chrome, plain in other browsers including Internet Explorer) and also with remote debugging options via the [console.re](console.re) service.

Downloads

9

Readme

angular-logger-max

A custom logger for angular with color coding (in Chrome, plain in other browsers including Internet Explorer) and also with remote debugging options via the console.re service.

The benefits of using this logger instead of vanilla console.log outputs is readability, extra information by default and the ability to turn all debugging on or off via Logger.debug = false or Logger.debug = true;

The exception to the above are errors and warnings which are always outputted to the console.

There are options to show the full stack in an output as well as whether to expand and print out objects by default on a per call basis.

As an example, here is a screenshot showing some of the different types of Logger method outputs:

browser console

Installation

There are two easy ways to install the Logger service:

####npm

npm install @iamadamjowett/angular-logger-max

With Bower

To install via Bower, run:

bower install angular-logger-max

Manual Installation

Download the logger.service.js file, and include it in your index.html file with something like:

<script type="text/javascript" src="/path/to/logger.service.js"></script>

Also be sure to include the module in your app.js file with:

angular.module('yourAppName', ['angular-logger-max']);

Usage

All Logger methods take the same parameters, all if which are option except for 'prepend', which if it is the only parameter passed, turns into the log message:

###Parameters

  • prepend - A string to prepend your output with, useful when labelling output of an object such as Logger.log('myObj: ', myObj);
  • msg - The main output string (if prepend is not passed, then prepend becomes the same as this). Can be of any type.
  • fullStack - A boolean indicating whether to output the entire stack trace (if it is gettable in the browser) for more detailed debugging (default false)
  • expand - A boolean indicating whether to expand objects by default via JSON.stringify (default false)
    Logger.log('This is a plain old boring log, but it will be colorful');
    Logger.info('An object, but not via Logger.data, expanded: ', someObj, false, true);
    Logger.shout('This is like a log, but loud, and stands out in the console');
    Logger.data('myObject structure: ', myObject);
    Logger.error('An error, so lets see the full stack trace', null, true, false);
    Logger.loaded('This controller has loaded, it is the same as a plain log just in a different colour');
    Logger.track('An event has been sent to tracking, this is like a plain log but muted down');

Output

Colours

logger-max has been designed for the Chome debugger, but will work in all major browsers. The colouring features at the moment are a Chrome only feature, with other browsers degrading gracefully depending on available features.

Module types

If you follow the naming convention of foo.controller.js or bar.directive.js for your different angular module types, logger-max will pick this up and output them in square brackets after the log type:

angular module

Logging to the http://console.re service

Integration into the remote logging service at console.re is available by default. To enable this feature, simply go to the console.re website and follow their "How to install" instructions.

angular-logger-max will automatically look to see if the library has been included, and if so, will log out to both the local console, and to the console.re console you have set up.

An example output looks something like this in the console.re console:

console.re output

When console.re is included, you will get duplicate logs in your browser console, to clean this up, you can filter by [#] to show only non-console.re logs:

filter