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

captainslog

v0.3.2

Published

Universal log wrapper for browser development. Runs on stardates.

Downloads

11

Readme

Captain.JS

A real log. For real starship captains.

Usage

First, summon your captain:

var captain = new Captain();

Then go ahead, and log your log entries

captain.log('Captain\'s Log, supplemental. Our computer core has clearly been tampered with and yet there is no sign of a breach of security on board. We have engines back and will attempt to complete our mission.');
// Returns: log entry Object, containing message, type and stardate

You can also get your captain to read your entire log for you, as it was entered:

captain.read();
// Outputs: Every entry in your `captain.history`

You can also access your captain's log in the captain.history array.

Settings

The constructor new Captain(name) supports one parameter: name, which sets your Captains name. Defaults to 'James T. Kirk'.

Secondly, debug mode can be set in captain.settings.debug or controlled by using captain.toggleDebug(). This controls if debug level logs are outputted or not.

API

Methods

All log methods (.log(), .debug(), .warn() and .error()) are used in the same way, much as the native console.log(). Your captain should sort out any environmental (browser) issues you might normally experience.

All log methods also enters your entry into your Captain's .history array.

Captain.log()

Outputs a normal log with arguments. Returns a log entry Object containing your message (arguments), type (log) and the current stardate using StarDate.

Captain.debug()

Outputs a debug log with arguments. Returns a log entry Object containing your message (arguments), type (debug) and the current stardate using StarDate. Be aware that debug-level logs might not be output if settings.debug is set to false.

Captain.warn()

Outputs a warning log with arguments. Returns a log entry Object containing your message (arguments), type (warn) and the current stardate using StarDate.

Captain.error()

Outputs a error log with arguments. Returns a log entry Object containing your message (arguments), type (error) and the current stardate using StarDate.

Captain.read()

Outputs all log entries in Captain.history using type, showing the entered stardate and message (arguments).

Captain.toggleDebug(bool)

This set's your Captain's behaviour - specifically whether or not debug level logs should be outputted. This method accepts one argument bool, the truthy/falsy value to set debug mode to. If undefined, the method will act as a switch from the current value.

Properties

Captain.history

Array containing all log entries made by your Captain.