tempest-framework icon indicating copy to clipboard operation
tempest-framework copied to clipboard

Environment-specific logger channels

Open brendt opened this issue 1 year ago • 3 comments

We need a way to define environment-specific logger channels.

My idea was to add an environments array to all channels, an add getEnvironments(): ?array on the interface.

return new LoggerConfig(
    channels: [
        new DailyLogChannel(
            path: 'path/to/log',
            environments: [Environment::PRODUCTION],
        ),
        new AppendLogChannel(
            path: 'path/to/log',
            environments: [Environment::DEV],
        ),
    ],
)

brendt avatar May 27 '24 05:05 brendt

@przemyslaw-przylucki what do you think?

brendt avatar May 27 '24 05:05 brendt

@brendt sorry - I was on a rather long business trip :/

I kinda like this approach but I feel like we could benefit more with env-specific config support like logger.production.php as we'll need more and more of that exentisivility.

Another cool thing would be to make initializers work like that too - it creates a bit more magic but also creates standards for how things are done. Not sure if I love it or not but it's an idea

przemyslaw-przylucki avatar Jun 22 '24 23:06 przemyslaw-przylucki

I kinda like this approach but I feel like we could benefit more with env-specific config support like logger.production.php as we'll need more and more of that exentisivility.

Oh I think I like that! Let's have a discussion about it on discord as well

brendt avatar Jul 22 '24 11:07 brendt