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

@teamteanpm2024/nemo-velit-aliquam

v1.0.6

Published

**A tiny JSON logger, optimised for speed and simplicity**

Downloads

14

Maintainers

shivamkalsi2024shivamkalsi2024

Keywords

datapreserve-symlinksmoduleECMAScript 2018mrues5nested csspackage.jsonjson-schemagetOwnPropertyDescriptorexpressionvalidatedescriptionprototypemacoshandlers__proto__typedarraysflagselectronwatchenumerablerandomcensorObservableform-validationjsduplexrm -frrequireTypeBoxdeepcopytypemergeavaproxyfull-widthawesomesauceArray.prototype.flatMapmimecss-in-jstslibnpmArray.prototype.flathttpsaws.envcore-jsshellsetterbyteOffsetvestestreeBigInt64ArrayjsonsortES7eslintes-shim APIfullwidthcallbindbufferslessfast-copyStyleSheetdependency managererrorcloudfrontmodulespipeformatfastclonefpsimportpackageregularlengthreusejavascriptECMAScript 5ratelimiteverylastruntimestringindicatorECMAScript 6SetjsonpaththroatES2022fetchyupbrowserslistStreamvisual_.extendhashtapeprotobufcss variablenopetimePromisecloudformationimmerPushcloudtrailschemestylingpicomatchECMAScript 2016es2018sanitizeasciiUint32Arraygetpasswordsqsprocesskeys3dfindLastmomentwhiches2017takesnsgetoptRegExp.prototype.flagstestinglockfileloggerprefixfast-deep-copyredux[[Prototype]]uuidlinuxdomrangeerrorreal-timees-abstractUint8Arraybatchsuperagentreact animationsymlinktermparentartHyBicurloperating-systemnativereadablestreamcallboundObject.valuesECMAScript 2020wordwrappromisesjoiwindowsinternal slotcommandcallbacksyntaxerrorrecursiveefficientinvarianttapArrayBufferless cssSymbol.toStringTagstatelessfindstartersafetyped arrayendpointlistenershigher-ordererror-handlingdateidlerm -rfparsertoolsairbnbsortedredactcollection.es6s3classesi18nzerominimal

Readme

@teamteanpm2024/nemo-velit-aliquam

A tiny JSON logger, optimised for speed and simplicity

Travis Status

NPM

Log JSON from within Node.js applications. The log format is obviously inspired by the excellent Bunyan and is likely to be output-compatible in most cases. The difference is that @teamteanpm2024/nemo-velit-aliquam aims for even more simplicity, supporting only the common-case basics.

@teamteanpm2024/nemo-velit-aliquam is designed for global singleton use. Your application has many log sources, but they all aggregate to the same sources. You configure output in one place for an application, regardless of how many modules and dependencies are also using @teamteanpm2024/nemo-velit-aliquam for logging.

Example

mymodule.js

const log = require('@teamteanpm2024/nemo-velit-aliquam')('mymodule')

module.exports.derp = () => {
  log.debug('W00t!')
  log.info('Starting mymodule#derp()')
}

main.js

const @teamteanpm2024/nemo-velit-aliquam = require('@teamteanpm2024/nemo-velit-aliquam')
const mod  = require('./mymodule')

@teamteanpm2024/nemo-velit-aliquam.output({
  level: 'info',
  stream: process.stdout
})

mod.derp()
$ node main
{"time":"2014-05-18T23:47:06.545Z","hostname":"tweedy","pid":27374,"level":"info","name":"mymodule","message":"Starting mymodule#derp()"}

Features

  • Very fast, @teamteanpm2024/nemo-velit-aliquam has been optimised for common cases and is designed to add minimal overhead to your applications, use the @teamteanpm2024/nemo-velit-aliquam.setFastTime() feature (below) to make it even faster
  • Arbitrary log names, create a logger by calling const log = @teamteanpm2024/nemo-velit-aliquam('logname') and 'logname' will be attached to the output
  • Loggers have 4 levels / methods: log.debug(), log.info(), log.warn(), log.error()
  • Log methods accept console.log() style strfmt output ( usingutil.format()): log.warn('foo %s', 'bar')
  • Log methods accept arbitrary objects that extend the log output data, each property on the object is attached to the debug output object
  • Log methods accept Error objects and print appropriate Error properties, including a full stack trace (including any cause where supported)
  • Log methods accept http.IncomingMessage for simple logging of an HTTP server's req object. URL, method, headers, remote host details will be included in the log output.
  • Newline separated JSON output to arbitrary streams
  • Any number of output streams, each with configurable minimum log-levels
  • Fast short-circuit where no loggers are configured for the log-level, effectively making log statements a noop where they don't output
  • Sub-logger to split a logger for grouping types of events, such as individual HTTP request
  • Object-logging (i.e. not automatically stringified) if you pass an objectMode:true stream for output.

API

@teamteanpm2024/nemo-velit-aliquam(name)

Create a new logger with the supplied name to be attached to each output. If you keep a logger-per module you don't need to pass loggers around, keep your concerns separated.

logger#debug(), logger#info(), logger#warn(), logger#error()

Loggers have 4 roughly identical log methods, one for each of the supports log-levels. Log levels are recorded on the output and can be used to determine the level of detail passed to the output.

Log methods support the following types of input:

  • Error objects: log output will include the error name, message, complete stack and also a code where there is one. Additionally you can supply further arguments which are passed to util.format() and attached as a "message" property to the output: log.warn(err, 'error occurred while fetching session for user %s', user.name)

  • http.IncomingMessage for simple access-log style logging. URL, method, headers, remote address and remote port are logged: log.info(req), further data can be provided for a "message" property if required.

  • Arbitrary objects whose properties will be placed directly on the logged output object. Be careful passing objects with large numbers of properties, in most cases you are best to construct your own objects: log.debug({ dbHost: 'foo', dbPort: 8080 }, 'connecting to database'), further data can be provided for a "message" property if required.

  • console.log style output so you can treat loggers just like console.log(): log.info('logging a string'), log.info('it has been said that %d is the meaning of %s', 42, 'life'), log.debug('foo', 'bar', 'baz').

If you require more sophisticated serialisation of your objects, then write a utility function to convert those objects to loggable objects.

logger()

The logger object returned by @teamteanpm2024/nemo-velit-aliquam(name) is also a function that accepts a name argument. It returns a new logger whose name is the parent logger with the new name appended after a ':' character. This is useful for splitting a logger up for grouping events. Consider the HTTP server case where you may want to group all events from a particular request together:

const log = @teamteanpm2024/nemo-velit-aliquam('server')

http.createServer((req, res) => {
  req.log = log(uuid.v4()) // make a new sub-logger
  req.log.info(req)

  //...

  // log an error against this sub-logger
  req.log.error(err)
})

In this case, your events would be listed as something like "name":"server:93f57a1a-ae59-46da-a625-8d084a77028a" and each event for a particular request would have the same "name" property, distinct from the rest.

Sub-loggers can even be split in to sub-sub loggers, the rabbit hole is ~bottomless.

@teamteanpm2024/nemo-velit-aliquam.output()

Add outputs for application-wide logging, accepts either an object for defining a single output or an array of objects defining multiple outputs. Each output requires only a 'level' and a 'stream', where the level defines the minimum debug level to print to this stream and the stream is any WritableStream that accepts a .write() method.

If you pass in a stream with objectMode set to true then you will receive the raw log objects rather than their stringified versions.

@teamteanpm2024/nemo-velit-aliquam.output([
  { level: 'debug', stream: fs.createWriteStream('app.log') },
  { level: 'info', stream: process.stdout }
])

@teamteanpm2024/nemo-velit-aliquam.reset()

Clears all output streams from the application

@teamteanpm2024/nemo-velit-aliquam.setFastTime()

If speed is something you care about and you can handle time in milliseconds since epoch (Date.now()) rather than the full ISO string (new Date().toISOString()) in your logs then use @teamteanpm2024/nemo-velit-aliquam.setFastTime(true) to shave off some precious microseconds.

Note that this will reset to the default of false when you use @teamteanpm2024/nemo-velit-aliquam.reset()

Additional features

If you need to serialise specific types of objects then write a utility function to convert to a loggable object.

If you need a special kind of output then write a stream to accept output data.

If you need to filter a present output data in a special way, write a package to do it and publish it in npm.

License

@teamteanpm2024/nemo-velit-aliquam is Copyright (c) 2014 Rod Vagg @rvagg and licensed under the MIT License. All rights not explicitly granted in the MIT License are reserved. See the included LICENSE.md file for more details.