martinheidegger / as3-commons

Automatically exported from code.google.com/p/as3-commons
0 stars 0 forks source link

LoggingTarget format a Wrong datetime string #101

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
eg.
var traceTarget:TraceTarget=new TraceTarget();
traceTarget.format="[{gmt} {date} {timeUTC}] {logLevel} - {shortName}{atPerson} 
- {message}";
LOGGER_FACTORY.setup = new SimpleTargetSetup(traceTarget);
var logger:ILogger = getLogger(this);
logger.info("you click {0},button label is {1}",[btn_log.id,btn_log.label]);

output.
[GMT+0800 2053/7/22 6:2:3.228] INFO - Main - you click btn_log,button label is  
test log

I find the source code 
in the LogMessageFormatter.as 

public function format(name:String, shortName:String, level:int,timeMs:Number, 
message:String, params:Array,person:String):String
{
  ...
   if( _hasTimeNode ) 
   {
      _now.time = isNaN( timeMs ) ? 0.0 : START_TIME+timeMs;
   }
  ...
}
timeMs already added together with START_TIME in TraceTarget.

Original issue reported on code.google.com by barron...@gmail.com on 12 Oct 2011 at 3:09

GoogleCodeExporter commented 8 years ago
YOU are awesome! Nobody seemed to have stumbled over this before. I am really 
wondering how I could I never stumbled upon it by myself. One can never have 
too many tests, right?

I added a fix and unit tests to the 
https://code.google.com/p/as3-commons/source/detail?r=1433

Thanks a lot!

Original comment by martin.h...@gmail.com on 12 Oct 2011 at 8:44