Comments (8)
Having a label would help to filter out particular logs, without introducing your own handler. As Konrad said, if you provide a label, it should be useful. As a user, Iād expect such behavior. Thanks!
from swift-log.
Hey guys, I've created convenience way to create a logger and use a label, see https://gist.github.com/ultraon/2659f1c6c8885e8d8dc47d45b9187449
Finally, I use it in this way: private let LOG = logger("MyTag")
,
and then in the same file: LOG.debug("my message)
,
output: 2019-12-15T22:02:26+0200 debug: MyTag: my message
from swift-log.
I would say it should not because I don't think that's what people really expect. Most logging systems don't actually force you to provide a label. I think the label is useful but we shouldn't force it on users. If they want it, as usually my answer would be 'bring you own LogHandler
' BYOL(H) ;).
No strong feeling here though, just my opinion
from swift-log.
I think logging to stdout/stderr is really common, people will expect it to work out of the box, and if we're shipping such a LogHandler
(and I think we should) we should make it super awesome.
from swift-log.
I think logging to stdout/stderr is really common, people will expect it to work out of the box, and if we're shipping such a
LogHandler
(and I think we should) we should make it super awesome.
Hmm, but this is deliberately just an API package because if we try to make it even 'maybe awesome' people will have conflicting opinions in what that means. So by shipping something barebones, literally just that it outputs something at all when you log, is the right choice IMHO.
Sure, for right now, where there's not many backend implementations it's a bit rough but I think that'll sort itself out :)
from swift-log.
In my custom LogHandler I print label
only if logLevel
is debug
or trace
. But I'm not entirely sure StdoutLogHandler
should utilize this logic, it's not that obvious for a random user :)
from swift-log.
In my custom LogHandler I print
label
only iflogLevel
isdebug
ortrace
. But I'm not entirely sureStdoutLogHandler
should utilize this logic, it's not that obvious for a random user :)
Yes, agreed.
from swift-log.
I would say it should not because I don't think that's what people really expect. Most logging systems don't actually force you to provide a label. I think the label is useful but we shouldn't force it on users.
API wise we do force it though, so I thought it is weird that we do force passing a label, but it never appears anywhere; printout wise if the label passed in is empty -- there's also no printout of it, so I don't think it changes the printing semantics if it was printed?
If they want it, as usually my answer would be 'bring you own LogHandler' BYOL(H) ;).
That's probably fair; I rely a lot on loggers during library development and have some needs for them -- so might as well just implement my own that "one should never use"ā¢ other than when I run my tests etc, since I need logging there.
from swift-log.
Related Issues (20)
- xcodebuild DocC error with Xcode 14 HOT 24
- Update SwiftFormat version HOT 1
- Provide Test Helpers Publicly HOT 6
- Toggle verbose or off HOT 1
- 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
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.