Giter Club home page Giter Club logo

Comments (8)

sirupsen avatar sirupsen commented on August 26, 2024

What do you think should happen in the case where you create a field with the name msg, time or level then?

from logrus.

rnapier avatar rnapier commented on August 26, 2024

Those should just be fields like any other fields. There shouldn't be magic keys that you have to avoid. If I want to pass "time" as a field meaning "the time the request was originally made," that shouldn't collide with the time the log message was created.

Rob

On May 19, 2014, at 6:14 PM, Simon Eskildsen [email protected] wrote:

What do you think should happen in the case where you create a field with the name msg, time or level then?


Reply to this email directly or view it on GitHub.

from logrus.

sirupsen avatar sirupsen commented on August 26, 2024

What should the default field name for time be then? I'm ok with making it up with the formatter, but I'm not getting you completely here.

from logrus.

rnapier avatar rnapier commented on August 26, 2024

I mean that Entry should have Msg, Time, and Level members of the struct rather than just mappings in Data:
type Entry struct {
Logger *Logger
Msg string
Time time.Time
Level Level
Data Fields
}

I know there are some backward compatibly questions, but v0.2 suggests your API isn't stable yet, so some breaking changes should be expected (good to do it all at once though). I don't think this will impact people unless they've written their own formatters, though.

This would get rid of lines like:

if key != "time" && key != "level" && key != "msg" {

Rob

On May 19, 2014, at 10:27 PM, Simon Eskildsen [email protected] wrote:

What should the default field name for time be then? I'm ok with making it up with the formatter, but I'm not getting you completely here.


Reply to this email directly or view it on GitHub.

from logrus.

sirupsen avatar sirupsen commented on August 26, 2024

Yeah, I'm on board with that and it makes sense. It doesn't solve one of the issues you talked about though, namely what to do in the situation when you log a field with the name msg, time or level.

from logrus.

rnapier avatar rnapier commented on August 26, 2024

If you log a field called msg, time, or level, nothing special should happen. It should print out in the list of data fields just like if you log a field called error or stuff. That way everything sent to .WithField() is treated the same.

from logrus.

sirupsen avatar sirupsen commented on August 26, 2024

I really don't get that part of the solution. Can you come up with an example?

from logrus.

sirupsen avatar sirupsen commented on August 26, 2024

#48

from logrus.

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.