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

rn-imx-logger

v1.0.21

Published

Imaxeam logger for react-native

Downloads

9

Readme

IMX LOGGER FOR REACT NATIVE APP

Installation

Step1

yarn add rn-imx-logger sp-react-native-mqtt

or

npm install  rn-imx-logger sp-react-native-mqtt --save

Step 2

under android/app/build.gradle add this lines of code :

android {
    configurations{
        all*.exclude module: 'conceal'
        all*.exclude module: 'bcprov-jdk15on'
  }
    //The rest of the android code 
}

Usage

import { imxRNLogger } from "rn-imx-logger";

const option = {
      clientId: new Date().getTime().toString(),
      uri: "mqtt://localhost:1883", 
      tls: false,
      auth: true,
      user: "user",
      pass: "password",
 };


const topicName = "logs"

const appName= "example_app_name"

const loggingStatus = {
    enableDebug: true, 
    enableError: true 
}

const callBacks = {
     onConnectCallBack: () => console.log("Connected"),
        onCloseCallBack() {
          console.log("Diconnected");
        },

      onErrorCallBack:(msg) => console.log("error ", msg),

      onMessageCallBack(msg) {
          console.log("message ", msg);
        },
}
  useEffect(() => {
   imxRNLogger.createMqttConnection(option,topicName,appName,loggingStatus,callBacks   );
    return () => {
      imxLogger.disconnect()
    };
  }, []);

// send DEBUG logs 
 imxRNLogger.debug({
      appName: "app_example",
      context: "context_example1",
      message: "message_example",
      user?: "user_example",
      extra?: any
  })

// send ERROR logs 
 imxRNLogger.error({
      appName: "app_example",
      context: "context_example1",
      message: "message_example",
      user?: "user_example",
      extra?: any
  })

//getMqttConnection
imxRNLogger.getMqttConnection()

//connect
imxRNLogger.connect()


//Disconnect 
imxRNLogger.disconnect()


//Set app name 
imxRNLogger.setAppName("Hello world !")

// Check is Connected
imxRNLogger.isConnected()


//Reconnect 
imxRNLogger.reconnect()


//Enable DEBUG  logging 
imxRNLogger.enableDebugLogging()

//Enable ERRORS logging 
imxRNLogger.enableErrorLogging()


// Disable DEBUG  Logging 
 imxRNLogger.disableDebugLogging()

// Disable ERROR Logging 
 imxRNLogger.disableErrorLogging()

// Check Error logging status
 imxRNLogger.checkErrorLoggingStatus()

// Check DEBUG logging status
 imxRNLogger.checkDebugLoggingStatus()

// check Logging enable or not 
 imxRNLogger.checkIsEnaled() // return {
                //  errorLoggingStatus: bool,
               //  debugLoggingStatus: bool,
              //       }

API

  • createClient(options, onCloseCallBack,onErrorCallBack,onMessageCallBack,onConnectCallBack) create new client instance with options, async operation

    • uriprotocol://host:port, protocol is [mqtt | mqtts]
    • host: ipaddress or host name (override by uri if set)
    • port: port number (override by uri if set)
    • tls: true/false (override by uri if set to mqtts or wss)
    • user: string username
    • pass: string password
    • auth: true/false - override = true Set to true if user or pass exist
    • clientId: string client id
    • keepalive
  • connect() connect from the connection created to MQTT

  • disconnect() disconnect from the connection created to MQTT

  • getMqttConnection() get all the connectionObject

  • debug({message: string, context: string,appName: string, user?: string}) : send logs as DEBUG

  • error({message: string, context: string,appName: string, user?: string}) : send logs as ERROR

  • isConnected() return Boolean

  • reconnect() reconnect from the connection created to MQTT

  • on(event, callback): add event listener for

    • event: connect - client connected
    • event: closed - client disconnected
    • event: error - error
    • event: message - message object
  • enableErrorLogging() to enable error logging

  • enableDebugLogging() to enable debuglogging

  • disableErrorLogging() to disable error logging

  • disableDebugLogging() to disable debug logging

  • checkDebugLoggingStatus() to check the debug logging status

  • checkErrorLoggingStatus() to check the error logging status

  • checkIsEnaled() to check the logging status of error and debug

  • setAppName() to set the app name sending in logs