Using the default Logging service in lower layers while maintaining the benefits of the logger, s...

What's the best way to use the default Logging service, but require it in lower layers? here's some unworking code just to show what i'm trying to do. The examples in the documentation would work https://effect.website/docs/requirements-management/layers/#database but then i believe i'd lose a lot of the value behind the logger, which for me is oTel. I know i ask a lot of questions, I'm very appreciative.
import { Context, Layer, Effect, Console, Logger } from "effect";

export class Database extends Context.Tag("app/database")<
    Database,
    {
        readonly createUser: (userId: string) => Effect.Effect<void>;
    }
>() {}

export const DatabaseTest = Layer.effect(
    Database,
    Effect.gen(function* () {
        const logger = yield* Logger.Logger; // certainly wrong
        return {
            createUser: (userId) => logger.log(`UserId: ${userId}`),
        };
    }),
);
Was this page helpful?