Implementing Logging for Environment Variable Parsing

Hello hello. I thought of doing this to define/validate environment variables.

import { Effect } from "effect";
import { Schema } from "@effect/schema";

const ANIMAL = Effect.runSync(
    Effect.orElseSucceed(
        Schema.decodeUnknown(
            Schema.Literal(
                "dogs",
                "rats",
                "bunnies",
                "cats",
                "gophers"
            )
        )(process.env["ANIMAL"]),
        () => "rats" as const
    )
);


I think it's good but any suggestion would be appreciated, I have a question tho... Do you know how could I implement logging? For example to log that there was a ParseError, and the "default" value was chosen?
Was this page helpful?