pupsnow / as3-commons

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

as3commons-logging: MateIntegration is ot really useful #72

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Just use it :-)

What is the expected output? What do you see instead?
detailed info about what happens, but you only get stuff like sequence started 
/ sequence ended
Problems is that no info is given about the sequence (what event triggered the 
sequence, etc.)
Also the loglevel is not honored.

What version of the product are you using? On what operating system?
2.5.1

Please provide any additional information below.
I created my own solution. cannot share the whole class, as it's for a 
commercial project, but the function below should give the idea:
Basically it uses the mate debug helper. That class unfortunately has a 
[ExcludeClass] so i copied the source in my project. Maybe the writers of mate 
can be contacted to remove that meta data.

        /**
         * Sends the logevent to as3commons.
         *
         * @param event event that should be sent.
         */
        private function logHandler(event:LogEvent):void
        {
            if (event.level < level)
            {
                return;
            }

            var category:String = IMateLogger(event.target).category;
            var e:MateLogEvent = MateLogEvent(event);
            var logger:org.as3commons.logging.api.ILogger = _cache[category] || (_cache[category] = getLogger(category, "mate"));

            switch (event.level)
            {
                case LogEventLevel.DEBUG:
                    logger.debug(event.message + " " + debuggerHelper.getMessage(e), e.parameters);
                    break;
                case LogEventLevel.INFO:
                    logger.info(event.message + " " + debuggerHelper.getMessage(e), e.parameters);
                    break;
                case LogEventLevel.WARN:
                    logger.warn(event.message + " " + debuggerHelper.getMessage(e), e.parameters);
                    break;
                case LogEventLevel.ERROR:
                    logger.error(event.message + " " + debuggerHelper.getMessage(e), e.parameters);
                    break;
                case LogEventLevel.FATAL:
                    logger.fatal(event.message + " " + debuggerHelper.getMessage(e), e.parameters);
                    break;
            }
        }

Original issue reported on code.google.com by arno...@gmail.com on 16 Aug 2011 at 12:07

GoogleCodeExporter commented 9 years ago
I adopted your Idea and extended it. I hope its now "more" useful.

greetings!

Original comment by mastakan...@gmail.com on 17 Aug 2011 at 4:32

GoogleCodeExporter commented 9 years ago
Awesome! Definitely more useful. Thanx a million for this great logging system 
and the quick response.

Arnoud

Original comment by arno...@gmail.com on 17 Aug 2011 at 5:13

GoogleCodeExporter commented 9 years ago
You are welcome. Happy to hear that you like the logging system.

yours
Martin.

Original comment by mastakan...@gmail.com on 18 Aug 2011 at 1:02