Skip to content

maxExceptionLines: auto does not work #17

@techieshark

Description

@techieshark

I like the effect provided by exception-formatter with option auto, where stack outside of your own code is truncated (automatically).

I can get that effect if I use the formatter directly:

import exceptionFormatter from 'exception-formatter';

const bunyanLogger = bunyan.createLogger({ ... });
bunyanLogger.addSerializers({
      // colorize and trim exceptions
      err: (e) => exceptionFormatter(e, {
        basepath: projectRoot,
        colors: true, // highlight our code in stack trace
        format: 'ansi', // color
        maxLines: 'auto', // auto: truncate code that isn't ours
      }),
    });

image

But if I use bunyan-debug-stream with maxExceptionLines: 'auto',

import bunyanDebugStream from 'bunyan-debug-stream';

const bunyanLogger = bunyan.createLogger({ ... });
    
bunyanLogger.addStream({
      stream: bunyanDebugStream({
        basepath: projectRoot, // this should be the root folder of your project.
        maxExceptionLines: 'auto',
      }),
    });

it does not truncate (though as shown by the color, it seems exception formatter successfully determines what is my code vs not my code):

image

See anything I'm missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions