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

@clerksystems/secretary

v1.0.16

Published

Logger

Downloads

52

Readme

Secretary Log Module

Table of Content

Description

The exported function is a factory for factories, this way you can provide a config that is used by all the individual loggers.

Main factory options

Option | Description --- | --- options.db | Sequelize options options.db.storage | Where to save the database options.db.logging | Should Sequelize log its actions? options.log | options.log.verbose | Should secretary log its internal actions? options.log.maxNrOfItems | How many items may be stored in the database options.log.itemThreshold | How many items the database should be able to store safely without overflowing options.log.maxCache | How many items the cache can hold options.log.uploadBulkSize | How many logs are in a single batch for uploading options.log.onOnline | This function takes a function which gets triggered when online status changes options.log.upload | This function is used to upload data

Factory options

Option | Description --- | --- options.source | Logger source name options.instructions | Object describing minimum levels and their log output options.styles | Overwrite default styling, use an object with level as key and chalk color function as value options.standardTrace | Startup logging function if its enabled in main options.log.verbose options.debug | Boolean indicating if debug messages should be traced options.dbLogger | Custom database logger

Default log levels

Option | Description --- | --- emergency | System unusable - exiting / shutting down alert | Act now or the application shuts down critical | Error on app level, but trying to continue error | Error on operation level. Definitely a problem that should be investigated. SysAdmin should be notified automatically, but doesn't need to be dragged out of bed. By filtering a log to look at errors and above you get an overview of error frequency and can quickly identify the initiating failure that might have resulted in a cascade of additional errors. Tracking error rates as versus application usage can yield useful quality metrics such as MTBF which can be used to assess overall quality warning | This MIGHT be problem, or might not. For example, expected transient environmental conditions such as short loss of network or database connectivity should be logged as Warnings, not Errors. Viewing a log filtered to show only warnings and errors may give quick insight into early hints at the root cause of a subsequent error. notice | Normal but significant info | Normal messages shouldn't be to many debug | Everything else, also this level is turned off from the console in production

Thoughts for future development

LogType

id source dataType type

0 product string filters-loading 1 product string startup-state 2 framework bool cloud-online-state 3 framework bool product-is-active

4 roon string sync-state

LogItem

id logTypeId level value

0 0 error could not load store 1 0 debug starting 2 1 info true 3 2 notice false

4 4 error { "msg": "lost", "time": 90654 } 4 4 error "found"

LogItem (large)

id source dataType type level data 0 product string filters-loading error could not load store

const logger = source -> type -> ( level, msg )

frmLogger( 'filter-state' )( 'mijn harde bericht' )

<5> sdfghjkl

const filterLogger = frmLogger.createType( 'filter-state' )

filterLogger.error( 'could not load' )

logger.syncTypes() ==> [ "delay" ]

logger.createType( 'delay', 'integer' )