From: Kevin G. <ke...@go...> - 2002-09-05 16:58:17
|
Nice work, a couple of questions: 1) Why are you reversing the order of the PRIORITY int's from log4j "these are actually REVERSED from log4j'cuz it makes our life easier."? How so, it's an arbitrary internal ordering, isn't it? While I understand that if it's arbitrary and internal then it doesn't matter, I think we should do our part to fight entropy by keeping unnecessary divergence to a minimun. 2) I agree that my suggested BEGIN block is not the way to do it, but I'm worried about create_custom_level(). If they call it after the engine has seen init(), it could result in undefined behavior. Could we just disallow it if $INITIALIZED is already set? 3) create_custom_level() should really be in Level.pm not Logger.pm, don't you think? And the interface to calling it could actually be in Log4perl.pm, a pass-thru. 4) For my own education, can you explain the rationale behind "This is a bit better way to create code on the fly than eval'ing strings." I understand that it may be faster, but in this case I can see advantages to the string eval in that you don't have to turn off strict refs, it catches cases where the user tries to name a level like WARN-LITE (where "warn-lite" is not a valid perl subroutine name, otherwise the error isn't caught until the user tries to call $log->warn-lite(..)), and in this case I think the intent of the code reads more clearly as an eval'd string. So my own knowledge is deficient--I can't see where the improvement is. 5) my $cust_prio = int(($priority{$after} + $next_prio) / 2); Just to be complete, we should check that they haven't added so many priorities that we've run out of halves and are stepping on existing numbers, shouldn't we? Erik W. Selberg wrote: > Actually, ignore my previous patch and check this one out. I took the > liberty of re-doing how the code is generated using the following syntax: > > *{ <foo> } = sub { <bar> } > > vs: > > $code = "sub foo { <bar> }"; eval $code; > > which enabled me to re-use it to auto-create new levels on the fly using: > > Log::Log4perl::Logger::create_custom_level("LITEWARN", "WARN"); > > I also re-did 025CustLevels.t with this in mind, as I think it's nicer > than the BEGIN block method. > > While I was at it, I also updated logdie and friends so they die > regardless of the OFF setting (and changed appropriate test classes), > and implemented the newer constants that Mike has (although note I'm > pretty sure this patch will clobber his). > > Cheers, > -e > > > > ------------------------------------------------------- > This sf.net email is sponsored by: OSDN - Tired of that same old > cell phone? Get a new here for FREE! > https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 > _______________________________________________ > log4perl-devel mailing list > log...@li... > https://lists.sourceforge.net/lists/listinfo/log4perl-devel -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |