mirror of
https://github.com/archtechx/tenancy.git
synced 2026-08-06 16:54:05 +00:00
This PR adds the LogChannelBootstrapper to provide tenant-specific logging configuration. The bootstrapper automatically configures storage path channels to use tenant-specific directories (NOTE: for this to work correctly, the bootstrapper has to run AFTER FilesystemTenancyBootstrapper, otherwise, the logs still won't be separated, unless you use overrides) and supports custom channel overrides for custom logging scenarios -- mapping tenant properties to the channel config, or using custom closures an array with the logging config, e.g. for making the slack channel (that's not handled by the bootstrapper by default) tenant-specific. The bootstrapper first modifies the channel config, then forgets the channel from LogManager so that on the next logging attempt, the channel is re-resolved with the modified config. Otherwise, the channel would just use the initial config **if the channel was resolved before**. If the channel wasn't resolved before, it'll always be resolved with the updated (tenant) config, unless the configuration fails. In that case, the config will be reverted (the central config will be restored) and the error will be logged using the original channel. When using a channel stack, the `stack` channel itself also has to be forgotten, since the LogManager could retain e.g. the original `stack` channel's webhook URL, while the underlying `slack` channel would use the updated one, and while logging, the app would actually use the initial webhook URL instead of the updated one (encountered this issue while testing). Note that **all** channels in `$storagePathChannels` and `$channelOverrides` are affected. Also, adding `'attachment' => 'false'` to the slack channel's config makes the slack channel work with Discord webhooks (just a cool thing we figured out whlle testing the bootstrapper). --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Samuel Štancl <samuel@archte.ch> |
||
|---|---|---|
| .. | ||
| impersonation-migrations | ||
| migrations | ||
| resource-syncing-migrations | ||
| config.php | ||
| routes.php | ||
| TenancyServiceProvider.stub.php | ||
| tenant_routes.stub.php | ||