Comments (5)
Ah, disregard the last message, sorry! I am seeing now in the code change that that will respect the multiple log levels 😃.
from swift-log.
Interesting catch, thanks for reporting!
So this is a weird interaction between how the Logger
decides if it should dispatch to the underlying handler or not, it does so by:
if self.logLevel <= level {
self.handler.log(level: level, ...
and the multiplex handler naively implements logLevel as:
public var logLevel: Logger.Level {
get {
return self.handlers[0].logLevel
so that's going to yield surprising behaviors as you just noticed.
I think we should be setting the loglevel to the "lowest of any passed in loggers" I suppose.
I'll give this a look since I have a moment now, thanks :-)
from swift-log.
Thanks @ktoso ! I just read over the PR comments and that discussion is really great. It seems like a valid workaround for now would be to just reorder the handlers that are being passed into the multiplex handler?
from swift-log.
Correct yes, until we land that PR and the behavior changes that's what is documented and the behavior -- so yeah, you can put the "lowest" log level one first and that should work :)
from swift-log.
Thanks for the quick reply!
I think maybe I have misunderstood some of that conversation on the PR, but now, by switching the order of the two loggers, trace
messages are still getting sent to MyLogger
which has its log level set to info
. Is that still expected?
from swift-log.
Related Issues (20)
- Crash when using error log / Incomplete LogHandler implementation HOT 2
- Infinite recursion between deprecated API's HOT 4
- MultiplexLogHandler to learn about metadata providers
- Add new Discord Logger to README HOT 2
- Make `StdioOutputStream` public HOT 1
- Supported way of accumulating metadata down the callstack HOT 9
- Logging function autoclosures aren't "rethrows" HOT 8
- Simplify logging `Error` types HOT 4
- Support advanced loghandler metadata use cases HOT 2
- Make StreamLogHandler initializers public
- How should I disclose using Swift Log in my iOS app?
- Unsupported runtime for visionOS HOT 1
- Fails to compile on Fedora 39 with Swift 5.8.1 (From repos) or official 5.9 binaries HOT 7
- PrivacyInfo Manifest HOT 2
- visionOS Compatibility HOT 1
- "Unsupported Runtime" when compiling for xrOS HOT 2
- Adding Error to log functions HOT 2
- CoW (copy-on-write) box the `Logger` components (for perf) HOT 2
- .string and .stringConvertable metadata value equality HOT 7
- Build fails when BUILD_LIBRARY_FOR_DISTRIBUTION is set to YES HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-log.