Skip to content

How to close/flush/end ? #2

Closed
Closed
@sp00x

Description

@sp00x

Was just testing this briefly and I notice that the scripts does not automatically close on completion, meaning there's probably some event handler or something that is left hanging, which is different from when using 'pino/file' where it terminates properly.

Is there some close() or end() or something method that needs to be called to make it terminate?

import pino from 'pino';

const transport = pino.transport({
  targets: [
    {
      level: 'trace',
      'target': '@jvddavid/pino-rotating-file',
      options: {
        path: "logs",
        //pattern: "log-%Y-%M-%d-%H-%m-%s-%l-%N.log",
        pattern: "log-%Y-%M-%d-%N.log",
        maxSize: 1024 * 1024 * 10,
        sync: true,
        fsync: true,
        append: true,
        mkdir: true,
      }
    }, 
    // {
    //   level: 'trace',
    //   target: 'pino/file',
    //   options: {
    //     destination: 'test.log'
    //   }
    // },
    {
      level: 'debug',
      target: 'pino-pretty',
      options: {
      }
    }
  ]
});

let logger = pino.pino(transport);

logger.info("hello");

// script is kept open, does not terminate .. terminates properly with pino/file

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions