Giter Club home page Giter Club logo

Comments (12)

VladPetriv avatar VladPetriv commented on August 23, 2024 1

@dstpierre If you don't have any questions I can start implementing it)

from core.

VladPetriv avatar VladPetriv commented on August 23, 2024 1

@dstpierre Sorry for misunderstanding.
And yes lumberjack has default value.
So we will use that)

from core.

VladPetriv avatar VladPetriv commented on August 23, 2024 1

Hey @dstpierre can you review my pr?

from core.

dstpierre avatar dstpierre commented on August 23, 2024

Some questions / thoughts to keep in mind:

  1. We need to stay backward compatible, so we'll need to have strong default when this get into production for version that will not change their config.
  2. I can see some devs wanting to have multi-output, we'll need a good way to configure this.
  3. What will be the strategy for replacing the current fmt.Println / log.Println with the new logger, is this part of this change?

I like to hdea of using APP_ENV with nice development defaults. I was looking at zerolog which says their "pretty" output isn't optimal, so this should only be enabled for APP_ENV=dev.

I'd like to discuss a bit regarding how one would configure this. As you explore which library you'd recommend, let us know what kind of options we have for non-console log (files, external services, etc).

Ideally I'd not want to add a hard dependency on a self-hosted log analysis. But we could certainly propose decent options.

from core.

VladPetriv avatar VladPetriv commented on August 23, 2024

What will be the strategy for replacing the current fmt.Println / log.Println with the new logger?

While watching the project I see that "fmt.Println / log.Println/ log.Fatal etc" doesn't happen very often.
So I guess that it won't be a problem to replace it manually.

Is this part of this change?

Yes sure.

I'd like to discuss a bit regarding how one would configure this. As you explore which library you'd recommend, let us know what kind of options we have for non-console log (files, external services, etc).

I don't know how to do this with "zerolog" because I have never worked with it.
But I know that "zap" logger has a built-in caller to write logs into the file and console at the same time.
Ex:
code

from core.

dstpierre avatar dstpierre commented on August 23, 2024

Multiple log output with zerolog.

So far I'd see the defaults behavior being:

APP_ENV=dev -> Use a "pretty" log output for all levels (debug, info, etc)

LOG_CONSOLE_LEVEL -> could be use to specify the minimum log level is wanted. For instance, LOG_CONSOLE_LEVEL=error would not includes trace,debug,info and warning level: https://github.com/rs/zerolog#setting-global-log-level

LOG_FILENAME -> if set, write logs to console and this file.

Now, should we think about monitoring size of this file? Who's responsible to clean this file?

How one ship this file to a 3rd party log analytics (self-hosted or paid).

Once we figure out the above, I think it'll be ready for implementation.

from core.

VladPetriv avatar VladPetriv commented on August 23, 2024

Now, should we think about monitoring size of this file? Who's responsible to clean this file?

It's not a problem we'll use "log rotation" with "lumberjack" + "zerolog".

How one ship this file to a 3rd party log analytics (self-hosted or paid).

Hmm. I don't expect to do this but probably in this part of the issue, it'll be manually working.
Maybe later we can do something better

from core.

VladPetriv avatar VladPetriv commented on August 23, 2024

"lumberjack" + "zerolog".

For example, it'll delete a log file after a certain period or when the file size equal to some value

from core.

VladPetriv avatar VladPetriv commented on August 23, 2024

Can you answer these questions?

  • How many days do you want to keep old log files?
  • How much max file size in MB do you want to see?
  • How many backups of log files do you want to see?

from core.

dstpierre avatar dstpierre commented on August 23, 2024

How many days do you want to keep old log files?

I'd say a sane default would be 14 days to 30 days. Since the goal is most certainly to "ship" those log files somewhere else.

How much max file size in MB do you want to see?

I'd say 150-250 MB is probably an acceptable default. Rough questions I'd say, it's very situational.

How many backups of log files do you want to see?

Something like 3-7? I honestly don't know.

Does the library you're planning to use for log rotation suggests "fit-all" defaults?

from core.

VladPetriv avatar VladPetriv commented on August 23, 2024

Does the library you're planning to use for log rotation suggests "fit-all" defaults?

What do you mean while saying "fit-all defaults"?

If you talk about "defaults" from yesterday's message #44 (comment). The answer will be yes

from core.

dstpierre avatar dstpierre commented on August 23, 2024

@VladPetriv I'm just saying that I do not have hard specifics personally regarding log rotation, so if lumberjack has sane defaults, we should use that also by defaults.

from core.

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.