Socket
Socket
Sign inDemoInstall

pino-tiny

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pino-tiny - npm Package Compare versions

Comparing version 1.1.2 to 2.0.0

dist/index.d.ts

53

package.json
{
"name": "pino-tiny",
"version": "1.1.2",
"description": "a very minimalist output for pino logger",
"main": "lib/index.js",
"version": "2.0.0",
"main": "dist/index.js",
"bin": {
"pino-tiny": "./lib/index.js"
"pino-tiny": "dist/index.js"
},
"scripts": {
"test": "npm run lint && npm run nyc",
"lint": "standard",
"tape": "tape ./tests/**/*.test.js | tap-spec",
"nyc": "nyc --reporter=text --reporter=text-summary --reporter=html npm run tape",
"postnyc": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100"
},
"repository": {

@@ -33,20 +25,27 @@ "type": "git",

"homepage": "https://github.com/holmok/pino-tiny#readme",
"dependencies": {
"@types/dateformat": "^3.0.1",
"chalk": "^4.1.2",
"dateformat": "^4.5.1",
"pump": "^3.0.0",
"split2": "^3.2.2",
"through2": "^4.0.2"
},
"devDependencies": {
"mockdate": "^2.0.5",
"nyc": "^15.0.1",
"proxyquire": "^2.1.3",
"sinon": "^9.0.2",
"standard": "^14.3.3",
"tap-spec": "^5.0.0",
"tape": "^5.0.0"
"@types/chalk": "^2.2.0",
"@types/node": "^16.7.10",
"@types/pump": "^1.1.1",
"@types/split2": "^3.2.1",
"@types/through2": "^2.0.36",
"@typescript-eslint/parser": "^4.30.0",
"eslint": "^7.32.0",
"ts-standard": "^10.0.0",
"typescript": "^4.4.2"
},
"dependencies": {
"chalk": "^4.0.0",
"debug": "^4.1.1",
"minimist": "^1.2.5",
"moment": "^2.25.1",
"pump": "^3.0.0",
"split2": "^3.1.1",
"through2": "^3.0.1"
"scripts": {
"lint": "ts-standard src/**/*.ts",
"clean": "rm -rf dist/",
"compile": "tsc",
"build": "yarn lint && yarn clean && yarn compile"
}
}
}
# pino-tiny
[![Build Status](https://travis-ci.com/holmok/pino-tiny.svg?branch=master)](https://travis-ci.com/github/holmok/pino-tiny/builds/)
a tiny little log formatter for [pino](https://github.com/pinojs/pino).

@@ -14,3 +11,3 @@

![screen-shot](./screen-shot-v1.1.png)
![screen-shot](./pino-tiny-output.png)

@@ -23,2 +20,4 @@ ## using it

npm i -D pino-tiny
--or--
yarn add --dev pino-tiny
```

@@ -38,3 +37,3 @@

"scripts": {
"start": "nodemon index.js | pino-tiny",
"dev": "nodemon index.js | pino-tiny",
...

@@ -45,42 +44,39 @@ }

## what does pino-tiny do?
## use it in code!
* shows log level, 3 characters, color coded, and ??? for custom log levels.
* timestamps (no dates). you know what day it is but millisecond timestamps give you some performace output
* strips all but the msg for output (with some special cases below)
* if there is are `res` and `req` properties in the log data, it will put dimmed request and response info (method, url, status code).
* non-json string data that get piped in (like nodemon) get treated as info logs and outputted.
* does not swallow error messages
* is extensible(ish)
pino-tiny can be used in code too as a prettifier, if you want. here is how you set it up:
## extensible(ish)?
```javascript
const { PinoTinyPrettifier } = require('pino-pretty')
const Pino = require('pino')
pino-tiny runs like a process you pipe the output of your application into and it makes nice output. it also exports a module that returns a `start` method that takes a `filter` function as a parameter.
const logger = new Pino({
prettifier: PinoTinyPrettifier(),
prettyPrint: true
})
this allows you to controll if a log entry gets printed, and you can mangle the output (in the `msg` property of the log). here is a ridiculous example:
logger.trace('trace message')
logger.debug('debug message')
logger.info('info message')
logger.warn('warn message')
logger.error('error message')
logger.fatal('fatal message')
```
```javascript
const { start } = require('pino-tiny')
## what does pino-tiny do?
function filter (data) {
if(data.msg.indexOf('happy') >= 0) {
// nothing happy gets out.
return false;
}
else {
// prepend msg with woah.
return {
...data,
msg: `[woah!] ${data.msg}`
}
}
}
//start the logger
start(filter)
```
* shows log level, 3 characters (and not a emoji icon), color coded, and ??? for custom log levels.
* timestamps (no dates). you know what day it is but millisecond timestamps give you some performance output
* strips all but the msg for output
* if there is are `res` and `req` properties in the log data, it will put dimmed request and response info (method, url, status code).
* non-json string data that get piped in (like nodemon) get treated as info logs and outputted.
* does not swallow error messages
* non-pino JSON will be logged as dimmed stringified JSON
more ideas in [examples](./examples)
### New in v2.0
### New in v1.1
* timings added to web logs.
* programmatic prettifier
* better colors
* handle non-pino json
* emojis! 🔎 🪲 ℹ️ ⚠️ 🔥 💣
* src is now in typescript
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc