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

vv-logger-tiny

v0.5.15

Published

very-very simple logger for save logs to local files

Downloads

8

Readme

Install & Use

npm i vv-logger-tiny
const logger = require('vv-logger-tiny').create(__dirname)
// or
// const logger = require('./index.js').create(__dirname, {level: 'trace', file_name_mask: 'app_${yyyymmdd}.log', days_life: 4, write_to_console: true})
// warning!!! in file_name_mask supported only one date mask - ${yyyymmdd}!!!

logger.trace('hello, trace!')
logger.debug('hello, debug!')
logger.error('hello, error!')
logger.error(new Error('hello, error!'))
logger.debug('user {0} delete document #{1}', {replace: ['Mark', '42']})
logger.error('error when user {0} delete document #{1}', {replace: ['Mark', '42'], traces: new Error('some error')})

Classes

Typedefs

App

Kind: global class

new App(path, [options])

| Param | Type | Description | | --- | --- | --- | | path | string | where store log files, default = __dirname | | [options] | constructor_options | additional options |

app._env : _partial.type_env

Kind: instance property of App

app.get_path() ⇒ string

Kind: instance method of App

app.set_option_days_life(days_life)

Kind: instance method of App

| Param | Type | | --- | --- | | days_life | number |

app.set_option_write_to_console(write_to_console)

Kind: instance method of App

| Param | Type | | --- | --- | | write_to_console | boolean |

app.set_option_level(level)

Kind: instance method of App

| Param | Type | | --- | --- | | level | type_log_level |

app.trace(message, [options])

Kind: instance method of App

| Param | Type | | --- | --- | | message | string | | [options] | message_options |

app.debug(message, [options])

Kind: instance method of App

| Param | Type | | --- | --- | | message | string | | [options] | message_options |

app.error(message, [options])

Kind: instance method of App

| Param | Type | | --- | --- | | message | string | Error | | [options] | message_options |

app.save_to_file_force([callback])

Kind: instance method of App

| Param | Type | | --- | --- | | [callback] | callback_error |

type_log_level : 'trace' | 'debug' | 'error'

logger level, default = 'debug'. if = 'trace', log work with ['trace','debug','error'], if = 'debug' - ['debug','error'], if 'error' - only 'error'

Kind: global typedef

constructor_options

logger options

Kind: global typedef
Properties

| Name | Type | Description | | --- | --- | --- | | [file_name_mask] | string | mask file name for store logger, default = 'app_${yyyymmdd}.log', where '${yyyymmdd}' - date write log. if mask without '${yyyymmdd}', delete old log files not working | | [days_life] | number | number of days for which log files will be stored, default = 4, only current date = 1, disable delete old log files = 0. you can change it in an already created class in method set_option_days_life | | [write_to_console] | boolean | write log to file and console (true) or in file only (false), default = true. you can change it in an already created class in method set_option_write_to_console | | level | type_log_level | logger level, default = 'debug'. if = 'trace', log work with ['trace','debug','error'], if = 'debug' - ['debug','error'], if 'error' - only 'error'. you can change it in an already created class in method set_option_level |

message_options

message options

Kind: global typedef
Properties

| Name | Type | Description | | --- | --- | --- | | [replace] | string | Array.<string> | for example: message = 'step #{0} where {1}', replace = [4, 'i create new file'], text result = 'step #4 where i create new file' | | [traces] | string | Error | Array.<string> | Array.<Error> | big attachment to message, for example - error with full stack |

callback_error : function

Kind: global typedef

| Param | Type | | --- | --- | | error | Error |