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

cordova-plugin-ouralabs

v1.3.2

Published

Cordova plugin for Ouralabs centralized remote logging platform.

Downloads

37

Readme

Cordova plugin for Ouralabs

This is a Cordova plugin for the Ouralabs centralized remote logging platform.

You can find out more about Ouralabs here: https://www.ouralabs.com.

This version of the plugin uses versions 2.7.0 (iOS) and 2.7.1 (Android) of the Ouralabs SDK. Documentation for Ouralabs SDK can be found here.

Install

To add the plugin to your Cordova project, simply add the plugin from the npm registry:

cordova plugin add cordova-plugin-ouralabs

Alternatively, you can install the latest version of the plugin directly from git:

cordova plugin add https://github.com/Justin-Credible/cordova-plugin-ouralabs

Usage

The plugin is available via a global variable named OuralabsPlugin. It exposes the following properties and functions.

All functions accept optional success and failure callbacks as their final two arguments, where the failure callback will receive an error string as an argument unless otherwise noted.

A TypeScript definition file for the JavaScript interface is available in the typings directory as well as on DefinitelyTyped via the tsd tool.

Log Levels

Log levels designate the severity of the log; used with the log() function. Log levels are ordered as shown below (least severe to most severe).

Ouralabs.LogLevel

  • TRACE
  • DEBUG
  • INFO
  • WARN
  • ERROR
  • FATAL

Example Usage:

OuralabsPlugin.log(OuraLabs.LogLevel.ERROR, ...);

Initialization

Initialize the Ouralabs plugin with the given channel ID string value. You can obtain your channel ID from the Ouralabs dashboard.

Method Signature:

init(channelId, successCallback, failureCallback)

Parameters:

  • channelId (string): The ID of the channel that logs will be written to.

Example Usage:

OuralabsPlugin.init("123...",
	function() {
		// Init success :)
	},
	function(err) {
		// Init failure :(
	});

Device Attributes

Allows setting of the three arbitrary attribute values that are stored with the device information.

Method Signature:

setAttributes(attribute1, attribute2, attribute3, successCallback, failureCallback)

Parameters:

  • attribute1 (string): The (optional) attribute value to set for the first attribute.
  • attribute2 (string): The (optional) attribute value to set for the second attribute.
  • attribute3 (string): The (optional) attribute value to set for the third attribute.

Example Usage:

OuralabsPlugin.setAttributes(userId, userName, email);

Logging

Logs a message with the given information.

Method Signature:

log(logLevel, tag, message, metadata, successCallback, failureCallback): void

Parameters:

  • logLevel (number): The level of the log; see LogLevels for possible values.
  • tag (string): The tag for the log entry.
  • message (string): The body of the log message.
  • metadata (any): An optional object to be appended to the log message in JSON format. If the object cannot be serialized into JSON it will be flattened into key/value pairs.

Example usage:

OuralabsPlugin.log(OuralabsPlugin.LogLevels.ERROR, "my_function", "Something went horribly wrong", event);

Log Helpers

Used to log a message with the given information. These are convenience shortcuts to the log() method. All of the following methods have the same method signature.

Methods:

  • logTrace(...)
  • logDebug(...)
  • logInfo(...)
  • logWarn(...)
  • logError(...)
  • logFatal(...)

Parameters:

  • tag (string): The tag for the log entry.
  • message (string): The body of the log message.
  • metadata (any): An optional object to be appended to the log message in JSON format. If the object cannot be serialized into JSON it will be flattened into key/value pairs.

Example usage:

OuralabsPlugin.logInfo("my_function", "It was called.");

OuralabsPlugin.logWarn("other_fucntion", "Something isn't right...", data);

Browser Console

The plugin can optionally integrate with the browser console in two ways:

  1. Ensure calls to OuralabsPlugin.log() (and its helper methods) will also show up in the browser console.
  2. Ensure out-of-band calls to the browser's console methods (eg console.log(...), console.error(...), etc) also get pushed into Ouralabs.

Both of these features are disabled by default and can be enabled with the following methods.

NOTE: It is not recommended to use these features in conjunction with the cordova-plugin-console plugin as it duplicates some of its functionality.

Show log entries in browser console

Method Signature:

setLogToBrowserConsole(enable)

Parameters:

  • enable (boolean): True to enable, false to disable.

Example Usage:

OuralabsPlugin.setLogToBrowserConsole(true);

Ensure native log entries are logged to Ouralabs

Method Signature:

setHookBrowserConsole(enable)

Parameters:

  • enable (boolean): True to enable, false to disable.

Example Usage:

OuralabsPlugin.setHookBrowserConsole(true);