Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 23 05:43
    mcollina commented #698
  • Aug 22 19:00
    danielsan opened #700
  • Aug 22 14:43
    mcollina commented #699
  • Aug 22 13:00
    eps1lon commented #699
  • Aug 22 12:10
    jsumners commented #699
  • Aug 22 08:55
    eps1lon commented #699
  • Aug 22 08:35
    zkochan commented #699
  • Aug 22 06:12
    mcollina commented #699
  • Aug 21 23:05
    jsumners commented #699
  • Aug 21 23:03
    jsumners commented #699
  • Aug 21 23:02
    jsumners commented #699
  • Aug 21 21:47
    zkochan commented #699
  • Aug 21 21:40
    jsumners commented #699
  • Aug 21 21:21
    zkochan commented #699
  • Aug 21 19:39
    jsumners commented #699
  • Aug 21 19:11
    zkochan edited #699
  • Aug 21 19:09
    zkochan opened #699
  • Aug 20 06:37
    nahtnam commented #698
  • Aug 20 06:36
    nahtnam commented #698
  • Aug 20 06:36
    nahtnam commented #698
n4zukker
@n4zukker
Thank you. That should help. I'll see if I can get you a PR.
n4zukker
@n4zukker
Sorry for the newbie question but what do I do instead of this:
$ git push -u origin leading-wildcard
Username for 'https://github.com': n4zukker
Password for 'https://n4zukker@github.com':
remote: Permission to pinojs/pino.git denied to n4zukker.
fatal: unable to access 'https://github.com/pinojs/pino.git/': The requested URL returned error: 403
James Sumners
@jsumners
@n4zukker you must "fork" the Pino project , do your work on your fork, and then submit a PR to the original Pino project. See https://jrfom.com/posts/2017/03/08/a-primer-on-contributing-to-projects-with-git/ for an overview of this process
n4zukker
@n4zukker
James, please review pinojs/pino#587 at your convenience.
n4zukker
@n4zukker
Travis CI build failed for the PR. The new and old unit tests passed so I presume it's not something with the code.
James Sumners
@jsumners
@n4zukker I cannot review at this time, but it looks like the failure is due to a reduction in test coverage. There is an npm script defined in the package.json that will generate a coverage report you can look at
n4zukker
@n4zukker
Ok. I was just doing npm run test. I'll check the other scripts.
npm run ci says ERROR: Coverage for branches (99.74%) does not meet global threshold (100%). I guess that's it.
n4zukker
@n4zukker
Ok. Checks pass now.
n4zukker
@n4zukker
Hi. I found a bug in the leading wildcard code from last week. I've sent you a PR. I also noticed that ["key", "key.foo"] would redact only "key.foo". The PR has a fix for that as well.
James Sumners
@jsumners
👍
n4zukker
@n4zukker
Hi. Would you please review and merge pinojs/pino#592. I'm available today to respond to any comments or concerns you raise. Thank you.
n4zukker
@n4zukker
Thank you all
hi2u
@hi2u
Hi, I'm new to using Pino, and just wondering if it's possible to use pino with scripts that have interactive terminal menus and stuff, for example https://github.com/SBoudrias/Inquirer.js/ menus... which obviously need full control of STDOUT to display and interact with the menus.
hi2u
@hi2u
To be more specific, considering pino seems to be made to only output to STDOUT, I'm not sure how I'd go about saving log records to a local log file without piping ... as I need interactive use of STDOUT for the menus, and therefore can't just pipe the output.
James Sumners
@jsumners
Supply your own destination stream
n4zukker
@n4zukker

Hi. Is there a gitter channel for the companion projects? I'd like to know how format of quick-format-unescaped should handle undefined. @davidmarkclements

> const format = require('quick-format-unescaped')
undefined
> format()
TypeError: Cannot read property 'length' of undefined
    at format (.../node_modules/quick-format-unescaped/index.js:25:21)
>

This shows up in pino:

> const log = require('pino')()
undefined
> var a
undefined
> typeof a
'undefined'
> log.info(a)
{"level":30,"time":1549027741763,"pid":8246,"hostname":"xxx","v":1}
undefined
> log.info({},'A',a)
{"level":30,"time":1549027761259,"msg":"A undefined","pid":8246,"hostname":"xxx","v":1}
undefined
> log.info(a,'A')
TypeError: Cannot read property 'length' of undefined
    at format (.../node_modules/quick-format-unescaped/index.js:31:16)
    at Pino.LOG [as info] (.../node_modules/pino/lib/tools.js:36:33)
> log.info({},a)
TypeError: Cannot read property 'length' of undefined
    at format (.../node_modules/quick-format-unescaped/index.js:31:16)
    at Pino.LOG [as info] (.../node_modules/pino/lib/tools.js:35:25)
hi2u
@hi2u
@jsumners How do I do that? Do I need to use https://www.npmjs.com/package/pino-multi-stream ?
James Sumners
@jsumners
@hi2u I did not say that. I said to provide your own stream -- http://getpino.io/#/docs/api?id=destination
n4zukker
@n4zukker
Hi. Would you please review pinojs/pino#599. This bug is causing pino to output lines which are not pino-prettyable. It's also a security issue (JSON injection attack).
I'd also like to hear comments about how pino should treat undefined arguments (see my messages above on Feb 1). And get direction about quick-format-unescaped should do when called without arguments (or with undefined).
n4zukker
@n4zukker
Andrey Goncharov
@keenondrums
Hey guys, I created a small lib that helps to use pino with CLS to get trace ids and other CLS-based goodness. Check it out! https://github.com/keenondrums/cls-proxify
Oliver Joseph Ash
@OliverJAsh

Hi, I'm just getting started with Pino. :-)

I have some concerns looking at Pino from a type safety perspective (TypeScript in my case).

With redaction, key paths are specified as a string. IIUC, it's impossible to make this type safe.

If I specify a redaction key path of myKey, this applies to all logs that include a key called myKey. What if I only want to apply the redaction to specific logs/objects? I would prefer to specify the redactions at the time of actually logging an object, as this gives much more flexibility.

I have a similar concern with regards to serializers. IIUC, serializers apply to all values with a given key like req. What if I log an object where req has a different type, such as a DOM request instead of an Express/Node HTTP request? Again this is not type safe. My serializer would potentially throw an exception at runtime.

/cc @mcollina
James Sumners
@jsumners
To be completely frank: you're not going to find much concern about TypeScript on the core Pino team
Matteo Collina
@mcollina
Typescript only enforces type safety at compile time anyway. There is no safety at runtime in any case.
Oliver Joseph Ash
@OliverJAsh
Of course, unless you validate the types at the boundary of your app using runtime types, e.g. io-ts.
peterpod-c1
@peterpod-c1

Hi, my company has a wrapper around pino which we've recently upgraded to work with v5.
I'm wondering how I can write a unit test to verify logs were printed to stdout. I've tried the following without luck.

cosnt spy = sinon.spy(process.stdout, 'write');
myAppLogger.info('info message');
expect(pinoSpy).to.have.been.called;

Any advice is appreciated.

Matteo Collina
@mcollina
You should attach your spy to logger[pino.symbols.streamSym]
peterpod-c1
@peterpod-c1
Thanks for the response. Trying that out now.
peterpod-c1
@peterpod-c1
It's not working exactly. I'm getting some undefined. Let me add more code to this context.
I am effectively creating a wrapper around pino which returns a child logger instance.
  const { logger } = require(`../../../lib/index`);
  describe(`when logger is configured with pino-pretty`, () => {
    beforeEach(() => {
      myAppLogger = logger({
        prettyPrint: true
      });
    });

    it(`then pino info method is called on pino instance`, () => {
      const pinoSpy = sinon.spy(logger[pino.streamSym], 'write');
      myAppLogger.info('info message');
      expect(pinoSpy).to.have.been.called;
      expect(pinoSpy).to.not.throw();
    });
  });
peterpod-c1
@peterpod-c1
Our logger also returns a child instance. So myAppLogger is efffectively pino(options, stream).child(props);
peterpod-c1
@peterpod-c1
Question about Serialization

If I have a custom request object similar to the following.

const request = {
    "headers": {
        "customer-ip-address": "0.0.0.0"
    },
    "path": "fake.path@",
    "method": "POST",
    "body": {...}

And I wish to add a serializer for this so that the request is a serialized json string in the logs. How is this different than logging the object directly to pino?

I'm hoping to print output like this.

log.info({'event': request});
// {"level":"info","time":1553869063349,"pid":41770,"hostname":"dca90498bed4","name":"myapp","event":{\"method\":'"post\",\"url\":\"fakepath@\",\"body\":\"body\"},"v":1}
Jonathan Stewmon
@jstewmon

howdy, just wanted to drop a note that i'm submitting a series of PRs in an effort to provide continuity across pino-std-serizliers, pino-http and koa-pino-logger...

the issue that motivated me to look into all this is pinojs/koa-pino-logger#19

it looks like there's just some drift between the libraries, so my goal is just to mainly to realign things

Matteo Collina
@mcollina
Awesome
We definitely need more maintainers
Dawid Karabin
@hinok
Hey, is there built already functionality to print timings between specific logger calls like debug (https://www.npmjs.com/package/debug) does? Something like pino-timings etc? I didn't find anything like that in pino-pretty.
Craig Taub
@craigtaub
anyone else having issues in latest release (5.12.4) on Mobile Safari?
We are getting the error "undefined is not an object (evaluating 'this.globalThis=this’)”on any versions of Mobile Safari using our site. We have had to revert to previous release.
Craig Taub
@craigtaub
Wasnt sure so have opened an issue.
Вадим Бударин
@budarin
hi everyone!
Is pino only for node.js?
is it possible to use it in browser to send logs to a server?
Вадим Бударин
@budarin
where can I find a real sample of using pino in browser?
Matteo Collina
@mcollina
pino also works in the browser
Rick Richardson
@rrichardson
is there any documentation on how to avoid memory bloat (or maybe how pino avoids memory bloat) when issuing a requestId in per-request logging scenarios (e.g. fastify)
some of our services are written in Koa and log with winston, and others use fastify/pino. And the fastify/pino services seem to accumulate far fewer objects. I'm just trying to pinpoint why so we can make recommendations to the other devs
Nestor Marin
@nemacrux

Hello, I'm trying to send logs to Logsene using pino-elasticsearch but the logs aren't sent. I can send logs with curl, but don't know what fails with pino-elasticsearch. This is the code:

node pino.test.js | pino-elasticsearch --index IndexName --host https://logsene-receiver.sematext.com --port 443

I also tried this

node pino.test.js | pino-elasticsearch --index  IndexName --node https://logsene-receiver.sematext.com

What could go wrong? Thanks

Matteo Collina
@mcollina
No idea, I’ve never used logsene
Nestor Marin
@nemacrux
Hello there, I'm just starting with Pino and wondering is there any guide/tutorial out there to implement custom transports? thanks in advance :)