mde / utilities

A classic collection of JavaScript utilities
Apache License 2.0
48 stars 23 forks source link

Make logging more flexible #4

Open larzconwell opened 12 years ago

larzconwell commented 12 years ago
<mde> I think they're just asking about custom logging.
<larzconwell> Yeah maybe. 
<mde> Which we don't support yet. I was going to attack the logging, until we bumped the auth stuff up.
<mde> That logging is in pretty terrible shape.
<larzconwell> Yeah it is, I'm going go to check out this thing for techwraith, and then after that I'll look at the logging stuff.
<mde> The code for it lives in three different places.
<larzconwell> Yeah let me know those, I'm gonna make an issue
<mde> What I really want is to use the one in utilities, and set it up so you can pass in a custom logger.
<larzconwell> Yeah that's what I was thinking as well
<mde> So, there's two types of logging -- the stdout and stderr.
<mde> And then the access log.
<mde> Right now we've hacked "access" to be treated like a log level.
<mde> But that's fucked up.
<larzconwell> So what should we do?
<mde> So, we need a base Logger class.
<mde> And there will be two subclasses: the one for stdout/stderr, and the one for access.
<larzconwell> Makes sense
<mde> The stdout/stderr one to support the different levels.
<mde> And the access one just to write to the access log.
<mde> But the access one will also support custom log-format.
<larzconwell> Okay that's nice]
<larzconwell> How will the log formatting be configured?
<mde> http://httpd.apache.org/docs/2.2/mod/mod_log_config.html
<mde> It will be a function much like the strftime thing in the date utility.
<larzconwell> Okay awesome, didn't know about that!
<mde> You can take a look at that, and just do the same basic thing.
<mde> So people will set a logFormat property in the config, and it will default to the normal Apache extended.
<larzconwell> Yeah that's what I'm gonna do
<mde> You can see in the current logging how it maps the different levels to either stdout or stderr
<mde> And there's this option of also printing to the console at the same time as logging.
<mde> It's a lot of work -- it'll keep you busy for a while. :D
<larzconwell> Do we wan't access to print to console or std*
<larzconwell> brb
<mde> Okay, so by default, all three logs should also print to the console.
<larzconwell> Wait keep going
<larzconwell> haha
<mde> And it's confusing, because Node's actual process.stdout is the same as console.log. :D
<larzconwell> That's what happens currently?
<mde> Yes.
<mde> But in our logging universe, the stdout.log is just a logfile we stream to.

Will format properly later, a bit busy at the moment