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

ut-port-console

v9.1.10

Published

UT port console module

Downloads

34

Readme

ut-port-console

'ut-port-console' is a module aimed to provide logs monitoring web interface for UT5 implementations. 'ut-port-console' works in cooperation with 'ut-log' (see 'ut-log' docs for more info). In order the two modules to be successfully bundled together a 'soketStream' stream/transport should be enabled for the 'ut-log' instance in a way that it creates a socket client which binds to console's host and port. The following code can be used for bundling the ut-log module with the ut-port-console interface:

var utLog = require('ut-log');
var utPortConsole = require('ut-port-console');
var SocketStream = require('ut-log/socketStream');
var consoleHost = '127.0.0.1';
var consolePort = '30001';
// ut-log
var utLogConfig = {
    type: 'bunyan',
    streams: [
        {
            level: 'trace',
            stream: new SocketStream({
                host: consoleHost,
                port: consolePort,
                objectMode: true
            }),
            type: 'raw'
        }
    ]
};
var logFactory = new utLog(utLogConfig);
var log = logFactory.createLog('info', {name: 'a', context: 'b'});
//ut-port-console
var consoleInstance = new utPortConsole();
consoleInstance.config.host = consoleHost;
consoleInstance.config.port = consolePort;
consoleInstance.init();
consoleInstance.start();

Then each message the logFactory instance logs will be sent to the console client through a websocket connection simultaneously.

i.e.

log.info('test');

will stream the message 'test' to the console.

Storing logs to LevelDB

'ut-log' and 'ut-port-console' can be configured in a way to share a common LevelDB database which can be used for storing and querying log messages. For this purpose a 'LevelDBStream' stream/transport should be added to the logger which share a common database instance with the console port. The following code demonstrates how that could be achieved:

var utLog = require('ut-log');
var level = require('level');
var utPortConsole = require('ut-port-console');
var SocketStream = require('ut-log/socketStream');
var LevelDBStream = require('ut-log/leveldbStream');
var consoleHost = '127.0.0.1';
var consolePort = '30001';
var logsDB = level('./logs');
// ut-log
var utLogConfig = {
    type: 'bunyan',
    streams: [
        {
            level: 'trace',
            stream: new SocketStream({
                host: consoleHost,
                port: consolePort,
                objectMode: true
            }),
            type: 'raw'
        },
        {
            level: 'trace',
            stream: new LevelDBStream(logsDB),
            type: 'raw'
        }
    ]
};
var logFactory = new utLog(utLogConfig);
var log = logFactory.createLog('info', {name: 'a', context: 'b'});
//ut-port-console
var consoleInstance = new utPortConsole();
consoleInstance.config.host = consoleHost;
consoleInstance.config.port = consolePort;
consoleInstance.db = logsDB;
consoleInstance.init();
consoleInstance.start();

Then each message the logFactory instance logs will be sent to the console client through a websocket connection and will be stored in './logs' leveldb database simultaneously.

i.e.

log.info('leveldb test')

will stream the message 'leveldb test' to the console and will store it to the db.