Effect CommunityEC
Effect Community3y ago
2 replies
ts

Creating a Custom Logger with Dependency on a Service

If I want my custom logger to depend on some service, I assume I would do it like this:
const Pino = /* ... assume this is some effectified pino, or whatever */
const logger = E.Logger.replaceEffect(
    E.Logger.defaultLogger,
    E.Effect.gen(function* (_) {
        const pino = yield* _(Pino);
        return E.Logger.make(info => {/* ... */});
    }),
);

?
Was this page helpful?