How to disable Logger?

transglobals's Avatar

transglobals

08 Jan, 2014 04:07 PM

Please how disable output panel many logger info in clear code?

  1. Support Staff 1 Posted by Ondina D.F. on 09 Jan, 2014 10:10 AM

    Ondina D.F.'s Avatar

    Hi,

    To disable the logger, you need to create a custom MVCSBundle like this:

    public class CustomMVCSBundle implements IBundle
        {
            public function extend(context:IContext):void
            {
                //context.logLevel = LogLevel.DEBUG;
                context.logLevel = 0;
                context.install(
                TraceLoggingExtension,
                VigilanceExtension,
                InjectableLoggerExtension,
                ContextViewExtension,
                EventDispatcherExtension,
                ModularityExtension,
                DirectCommandMapExtension,
                EventCommandMapExtension,
                LocalEventMapExtension,
                ViewManagerExtension,
                StageObserverExtension,
                MediatorMapExtension,
                ViewProcessorMapExtension,
                StageCrawlerExtension,
                StageSyncExtension);
                
                context.configure(ContextViewListenerConfig);
            }
        }
    

    and use it like this:

    context = new Context()
        .install(CustomMVCSBundle)
        .configure(new ContextView(this));
    

    In your CustomMVCSBundle, you either comment out context.logLevel = LogLevel.DEBUG; or set it to 0, like in the example above, or you don't install the TraceLoggingExtension.

    So, if you'd have a Bundle like this one:

    public class CustomMVCSBundle implements IBundle
        {
            public function extend(context:IContext):void
            {
                context.install(
                TraceLoggingExtension,
                VigilanceExtension,
                InjectableLoggerExtension,
                ContextViewExtension,
                EventDispatcherExtension,
                ModularityExtension,
                DirectCommandMapExtension,
                EventCommandMapExtension,
                LocalEventMapExtension,
                ViewManagerExtension,
                StageObserverExtension,
                MediatorMapExtension,
                ViewProcessorMapExtension,
                StageCrawlerExtension,
                StageSyncExtension);
                
                context.configure(ContextViewListenerConfig);
            }
        }
    

    then you can control the logger by setting it to whatever you need it to be:

    context = new Context()
        context.install(CustomMVCSBundle)
        //context.logLevel = 0;
        //context.logLevel = LogLevel.INFO;
        context.logLevel = LogLevel.DEBUG;
        context .configure(new ContextView(this));
    

    I hope that helps.
    Ondina

  2. 2 Posted by transglobals on 09 Jan, 2014 10:27 AM

    transglobals's Avatar

    uff, thanks

  3. Support Staff 3 Posted by Ondina D.F. on 09 Jan, 2014 11:12 AM

    Ondina D.F.'s Avatar

    no problem

  4. Ondina D.F. closed this discussion on 09 Jan, 2014 11:12 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac