Skip to content

Pretty logger doesn't use source maps for error stack traces in the browser #6090

@OliverJAsh

Description

@OliverJAsh

What version of Effect is running?

3.19.19

What steps can reproduce the bug?

import { Cause, Effect, Logger } from 'effect';

const logger = Logger.prettyLogger({ mode: 'browser' });

const makeErrorCause = () => new Error('oops 1');

const makeError = () => new Error('oops 2', { cause: makeErrorCause() });

const program = Effect.logError('Hello, Effect!', Cause.fail(makeError()));

Effect.runSync(
  program.pipe(Effect.provide(Logger.replace(Logger.defaultLogger, logger))),
);

What is the expected behavior?

The printed error stack trace should use source maps.

For example, here it is working when I switch a custom logger:

Image
const logger = Logger.make(({ logLevel, message, cause }) => {
  globalThis.console.log(
    `[${logLevel.label}] ${message}`,
    Cause.isEmpty(cause) ? undefined : Cause.squash(cause),
  );
});

What do you see instead?

The printed error stack trace does not use source maps:

Image

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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