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

@ubisense/smartspace.logview

v1.0.1

Published

Ubisense LogView client side library

Downloads

1

Readme

LogView

This is the Ubisense LogView javascript client side library.

LogView allows client applications to subscribe to live platform log messages from SmartSpace® and other integrated log sources, such as ACS. LogView uses SignalR, and this library is a simple wrapper around a SignalR client.

Full documentation of LogView is currently maintained on Ubisense Docs.

Getting Started

Create an LogView instance, start it, and then call .requestLog to subscribe to particular matching log messages.

...
let lv = new LogView(anon);
lv.setTarget((data) => { console.log(data.message); });
lv.start().then(() => {
	lv.requestLog('SmartSpace','/warning|log_view/');
	lv.requestLog('SmartSpace','ls_');
	lv.requestLog('ACS','Fill','6i2CGhIbuqb1JT7G00000G000uf:ACS::AssemblyLine');
});
...

Simple Usage

The constructor takes a single argument which can be either:

  • Missing, in which case the class connects to the authenticated hub, and the user must be logged in to the SmartSpace web site. The user must be a member of the System.Web.LogViewer role.
  • A boolean, in which case true means to connect to the anonymous hub, which does not authenticate the user. The anonymous user must be a member of the System.Web.LogViewer role. If false, uses the authenticated hub.
  • A string, in which case this is the URL of the hub to which LogView will connect.

The setTarget method takes either:

  • A function, in which case the function is called with a single argument which is the log item.
  • An object, in which case the object is assigned each log item as it arrives.
  • An object and a string property name, in which case obj[prop] is assigned each log item as it arrives.

The latter two methods are intended for use in reactive frameworks. In any case the log values delivered by LogView are objects with the following form:

{
	"when": a Date object, when the log message was raised,
	"source": the source string, such as "SmartSpace" or "ACS",
	"logObject": the object id of the log source, if there is one,
	"message": the log message itself
}

The start method attempts to connect to the hub to start receiving log messages. It returns a promise, so .then can be used to request logs on success, or .catch can be used to respond to connection errors.

The requestLog method subscribes for log messages. The LogView instance must have been started before it is called. It takes up to three arguments:

  • The source, which is currently either "SmartSpace" or "ACS"
  • The filter to apply, which is a string to match in the message line. If the filter starts and ends with '\' then it is treated as an ECMAScript regex pattern to match in the message.
  • The log object, only used by "ACS" sources. This is the object id of the log object to subscribe to, such as an ACS Assembly Line or Device.

The clearLogs method removes all current subscriptions.

The logMessage method can be used to generate a SmartSpace log from a javascript client. The first parameter is the message to send, and the second parameter is the monitor stream to send it on, with "log_view" the default if not specified.