Skip to content

App doesn't exit when I use this library #60

@bmaupin

Description

@bmaupin

Oddly enough, I ran across this exact same problem testing winston-syslog: winstonjs/winston-syslog#155

If I test bunyan by itself, then this code runs and exits normally:

const bunyan = require('bunyan');

const logger = bunyan.createLogger({
  name: 'graylog-syslog-bunyan',
});

logger.error('Test message');

However, when I use this library, the app no longer exits:

const bunyan = require('bunyan');
const bsyslog = require('bunyan-syslog');

const logger = bunyan.createLogger({
  name: 'graylog-syslog-bunyan',
  streams: [
    {
      level: 'debug',
      type: 'raw',
      stream: bsyslog.createBunyanStream({
        host: '127.0.0.1',
        port: 5140,
      }),
    },
  ],
});

logger.error('Test message');

Instead, I have to manually exit:

setTimeout(() => {
  process.exit();
}, 500);

Some more information in case it helps:

$ node --version
v14.17.5
$ grep bunyan package.json
    "bunyan": "^1.8.15",
    "bunyan-syslog": "^0.3.3",

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions