Can't change MVCS bundle defaults logLevel

katopz's Avatar

katopz

18 Jul, 2013 06:41 AM

Hi guys

I did search for "logLevel" but nothing return so i should ask.
Question is how can i turn if off?
refer to
https://github.com/robotlegs/robotlegs-framework/blob/master/src/robotlegs/bender/framework/readme-logging.md
at
Note: The MVCS bundle changes these defaults. It adds a TraceLogTarget and sets the log level to DEBUG.
far as i try is
-----------------------------------------------------------------
public class AppBundle extends MVCSBundle
{
override public function extend(context:IContext):void
{
// try...
context.logLevel = LogLevel.ERROR;

super.extend(context);

// try harder!
context.logLevel = LogLevel.ERROR;
}
}
-----------------------------------------------------------------
but i still get DEBUG trace out...

or maybe some other way to completely turn it off?

Thanks

  1. Support Staff 1 Posted by Ondina D.F. on 18 Jul, 2013 12:58 PM

    Ondina D.F.'s Avatar

    Hi,

    3 options:

    • See the values for the log level constants:
    public class LogLevel
    {
            public static const FATAL:uint = 2;
    
            public static const ERROR:uint = 4;
    
            public static const WARN:uint = 8;
    
            public static const INFO:uint = 16;
    
            public static const DEBUG:uint = 32;
    

    Now, set _context.logLevel = 0, or to an integer different from the ones of the defined constants.

    • Create your own MVCS bundle, where you can comment out the context.logLevel = LogLevel.DEBUG; or set it to whatever else you need it to be

    • if you don't need the TraceLoggingExtension at all, just don't install it in your custom MVCS Bundle

    Here is the original MVCSBundle:
    https://github.com/robotlegs/robotlegs-framework/blob/master/src/ro...

    And , of course, if you create your own bundle then you'll have to install it instead of the MVCSBundle

    _context = new Context();

    context.install(SomeCustomMVCSBundle):

  2. 2 Posted by katopz on 19 Jul, 2013 04:47 AM

    katopz's Avatar

    Hi,

    After looking at the code, I feel that MVCSBundle shouldn't has

    context.logLevel = LogLevel.DEBUG;

    like you said at option 2,

    so i'm now work around by completely override public function extend and won't call super (just realized my problem at first is super set logLevel back eventually i call super.extend)

    i really want to vote to get rid of it so i can shorten my code to 1 line instead of plenty of import and extends new Class e.g.
    ---------------------------------------------------------------------------------------------
    new Context().install(MVCSBundle, SignalCommandMapExtension)
    ---------------------------------------------------------------------------------------------
    compare to...
    ---------------------------------------------------------------------------------------------
    new Context().install(AppBundle)

    package
    {
    import robotlegs.bender.bundles.mvcs.MVCSBundle;
    import robotlegs.bender.extensions.contextView.ContextViewExtension;
    import robotlegs.bender.extensions.contextView.ContextViewListenerConfig;
    import robotlegs.bender.extensions.contextView.StageSyncExtension;
    import robotlegs.bender.extensions.directCommandMap.DirectCommandMapExtension;
    import robotlegs.bender.extensions.enhancedLogging.InjectableLoggerExtension;
    import robotlegs.bender.extensions.enhancedLogging.TraceLoggingExtension;
    import robotlegs.bender.extensions.eventCommandMap.EventCommandMapExtension;
    import robotlegs.bender.extensions.eventDispatcher.EventDispatcherExtension;
    import robotlegs.bender.extensions.localEventMap.LocalEventMapExtension;
    import robotlegs.bender.extensions.mediatorMap.MediatorMapExtension;
    import robotlegs.bender.extensions.modularity.ModularityExtension;
    import robotlegs.bender.extensions.signalCommandMap.SignalCommandMapExtension;
    import robotlegs.bender.extensions.viewManager.StageCrawlerExtension;
    import robotlegs.bender.extensions.viewManager.StageObserverExtension;
    import robotlegs.bender.extensions.viewManager.ViewManagerExtension;
    import robotlegs.bender.extensions.viewProcessorMap.ViewProcessorMapExtension;
    import robotlegs.bender.extensions.vigilance.VigilanceExtension;
    import robotlegs.bender.framework.api.IContext;

    public class AppBundle extends MVCSBundle
    {
    override public function extend(context:IContext):void
    {
    context.logLevel = 0;

    context.install(TraceLoggingExtension,
    VigilanceExtension,
    InjectableLoggerExtension,
    ContextViewExtension,
    EventDispatcherExtension,
    ModularityExtension,
    DirectCommandMapExtension,
    EventCommandMapExtension,
    LocalEventMapExtension,
    ViewManagerExtension,
    StageObserverExtension,
    MediatorMapExtension,
    ViewProcessorMapExtension,
    StageCrawlerExtension,
    StageSyncExtension,
    SignalCommandMapExtension);

    context.configure(ContextViewListenerConfig);
    }
    }
    }
    ---------------------------------------------------------------------------------------------
    all this just for silent log...which give me an awkward moment

    hope you guy see the problem and get rid of it ;\
    or i've to fork whole project to just comment this out?...still awkward

    no worry i just saying on sinking boat ;)

    Thanks

  3. Support Staff 3 Posted by creynders on 19 Jul, 2013 07:55 AM

    creynders's Avatar

    There's really no need to extend MVCSBundle, as long as it implements
    IBundle it's fine.

    And if you want to turn off logging altogether it's best to not install
    TraceLoggingExtension and InjectableLoggerExtension.

    And regarding the automatic loglevel setting: I don't know, every developer
    will have her own idea on what should or should not be included in the
    MVCSBundle. MVCSBundle's really just a convenience class, it was never
    meant to be a mandatory class.

  4. Support Staff 4 Posted by Ondina D.F. on 19 Jul, 2013 07:56 AM

    Ondina D.F.'s Avatar

    Yes, you're right, maybe the MVCSBundle should not install the TraceLoggingExtension and set the logLevel.
    Until this will change, you can make your own bundle, as I said:

    MinimalistBundle
    
    public function extend(context:IContext):void
    {
        context.install(
    
        VigilanceExtension,
        ContextViewExtension,
        EventDispatcherExtension,
        DirectCommandMapExtension,
        EventCommandMapExtension,
        LocalEventMapExtension,
        ViewManagerExtension,
        StageObserverExtension,
        MediatorMapExtension,
        StageCrawlerExtension,
        StageSyncExtension
    
        );
        context.configure(ContextViewListenerConfig);
    }
    
    _context = new Context()
        .install(MinimalistBundle)
        .configure(MediatorsConfig, ModelsConfig, ControllersConfig)
        .configure(new ContextView(view));
    

    all this just for silent log...which give me an awkward moment

    The MVCSBundle is just a convenience class. If you use your own bundle, you are free to customize it as you wish. For example, if you don't have multiple contexts in your app, you don't need the ModularityExtension, so you just don't include it in your bundle...and so on.

  5. Ondina D.F. closed this discussion on 26 Jul, 2013 10:58 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