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

react-native-power-logger

v2.0.0

Published

A react-native specific debugging tools, a lightweight customizable logger to log regular items, the react-native bridge, async storage and array's maps

Downloads

7

Readme

NPM version license

React-native-power-logger

A react-native specific debugging tools, a lightweight customizable logger to log regular items, the react-native bridge, async storage and array's maps

Example:

console.pl.logStorage(); // See in table format all your react-native async storage

Installation

$ npm install react-native-power-logger

Then, in index.js or at top of your application:

const RNlog = require('react-native-power-logger');
'...or'
import RNlog from 'react-native-power-logger';

console.pl = RNLog;

Usage

you can now use regular console around, and have a console.pl object that contains all the Power Logger methods!

So you can do:


console.pl.logBridge(); // this will log the bridge messages

Test on demo project

  1. Install react-native cli
  2. open path in terminal and run: react-native init demo && cd demo && npm install react-native-power-logger
  3. import and place some code on top of test application to have insight of bridge
import RNlog from 'react-native-power-logger'

RNlog.logBridge();
AppRegistry.registerComponent(appName, () => App);

What can i do?

  1. Log React-native bridge, filters can be applied to choose only one way of data flow, specific method or module name
  2. Log React-native async storage, dumps all the data from async storage, displayed in table format
  3. Log items with customizable prefix, break line, colors and level of importance
  4. Log from already in place Array.prototype.map
  5. Log from specific Array.prototype.logMap placed in code before being changed in favor of regular "map"

API

overrideArraysMap()


overrideArraysMap()

const testArray = [ "a","b","c" ];

testArray.map(item => item); // every cicle will log current item, index and total array

enableArraysLogMap()


enableArraysLogMap() //extend native with Array.prototype.logMap

const testArray = [ "a","b","c" ];

testArray.map(item => item); // this will remain a regular map
testArray.logMap(item => item); // every cicle will log current item, index and total array

logStorage()


logStorage() // returns a table in console with async storage data displayed

logBridge(versus, prefix)

[optional, string] versus: "toJavascript" || "toNative" , [optional, string] prefix: "prefix-message"


logBridge() // returns in console a log of every data exchange in react-native bridge

findInBridge(targets, prefix)

[optional, string[]] targets: ["module name", "method name"] , [optional, string] prefix: "prefix-message"


findInBridge() // returns in console a log of the items we need to look up in bridge

log(target, prefix, level, lineBreak, breakColor)

[optional, any ] target: objINeedToLog , [optional, string] prefix: "prefix-message" , [optional, string] level: "info" || "warn" || "err" , [optional, boolean] lineBreak: true , [optional, string] breakColor: "#fff"


log() // returns a customized console.log

info(target)


info() // returns a console.info

warn(target)


warn() // returns a console.warn

err(target)


err() // returns a console.err

trace()


trace() // returns a console.trace

Warnings

overrideNativeMap will override the native Array.prototype.map, use it only for debugging. When turned on will dump all items from all the array's maps (frameworks included).

Support

Star the project if you liked! Share it, fork it or contribute to improve it.

TODO

  • [ ] Log http requests
  • [ ] Track foreground-background
  • [ ] Track performance