Giter Club home page Giter Club logo

Comments (8)

shpakovski avatar shpakovski commented on June 17, 2024 4

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.

ultraon avatar ultraon commented on June 17, 2024 1

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.

weissi avatar weissi commented on June 17, 2024

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.

ianpartridge avatar ianpartridge commented on June 17, 2024

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.

weissi avatar weissi commented on June 17, 2024

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.

kirilltitov avatar kirilltitov commented on June 17, 2024

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.

weissi avatar weissi commented on June 17, 2024

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 :)

Yes, agreed.

from swift-log.

ktoso avatar ktoso commented on June 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.