How to use the pino.symbols.streamSym function in pino

To help you get started, we’ve selected a few pino examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ideal-postcodes / postcodes.io / test / logging.integration.js View on Github external
"use strict";

const { assert } = require("chai");
const { postcodesioApplication, configFactory } = require("./helper");
const { symbols } = require("pino");

const stream = symbols.streamSym;

describe("Log configuration", () => {
  it("writes to stdout if file not defined", () => {
    const config = configFactory();
    config.log.file = undefined;
    const { pcioLogger } = postcodesioApplication(config);
    const output = pcioLogger[stream];
    assert.equal(output.fd, 1);
  });

  it("writes to file if destination set to file", () => {
    const config = configFactory();
    config.log.file = "/tmp/test.log";
    const { pcioLogger } = postcodesioApplication(config);
    const output = pcioLogger[stream];
    assert.include(output.file, config.log.file);