Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only the first log handler is triggered when logging to Puppy with multiple handlers #89

Open
thisisaaronland opened this issue Oct 20, 2023 · 0 comments

Comments

@thisisaaronland
Copy link

Using Puppy in a swift-log context with multiple handlers (console and file rotation) only the first handler added to a Puppy instance is invoked. For example:

https://github.com/sfomuseum/swift-image-emboss-grpc/blob/main/Scripts/image-emboss-grpc-server/Server.swift#L48-L73

The ordering of the handlers does not seem to matter. If I add the console handler first then messages are logged to the console but not the file handler (though the file is created) and vice versa.

This particular application has a somewhat convoluted logging setup necessitated by the steps required to pass metadata (in this case a remote address property) in a gRPC server context and the need to create a custom swift-log wrapper that can be updated (with the remote address metadata) and not trigger compiler warnings which necessitates making the wrapper @unchecked Sendable.

https://github.com/sfomuseum/swift-image-emboss-grpc/blob/main/Sources/ImageEmbossGRPC/Interceptors.swift
https://github.com/sfomuseum/swift-image-emboss-grpc/blob/main/Sources/ImageEmbossGRPC/Logger.swift
https://github.com/sfomuseum/swift-image-emboss-grpc/blob/main/Sources/ImageEmbossGRPC/Embosser.swift#L21

I don't think that's the problem but I am also not super familiar with Sendable yet. I am pretty sure I doing everything as explained in the docs but maybe I am missing something?

Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant