robotlegs-sharp / robotlegs-sharp-framework

An C# application framework. Ported from Robotlegs for ActionScript 3.
MIT License
84 stars 25 forks source link

Rename ILogger #6

Closed mattmurton closed 8 years ago

mattmurton commented 8 years ago

Unity have now added their own ILogger Class (UnityEngine.ILogger).

This has introduced some rather annoying ambiguous reference errors when using Robotlegs ILogger without prefixing the namespace. It's annoying to always need to do that so I suggest we rename the ILogger interface, maybe IRobotlegsLogger?

It's a bit longer but at least it should always be unique.

What do you think @prankard ?

mikecann commented 8 years ago

Gets my vote :+1:

prankard commented 8 years ago

Hmm, my gut to is keep this framework as close to the original RL framework as possible, So renaming classes is not a great idea.

However, if you use the ILogger, this is really annoying. And one of the best things about RL was that it does a LOT for you, and by conflicting with other classes actually takes away the simplicity of using the framework.

At first glance I wanted to inject the ILogger Unity class which we would map as the logger. However, it's more like an ILogTarget not an ILogger (the classes are very different).

So, let's change the name. Keeping it small as possible for me is best. IRobotlegsLogger is pretty annoying to type out constantly. But might be an option. My ideas for a classname are as follows:

ITracer IReport IDebug ILog IRogotlegsLogger IContextLogger ILogManagerLogger

I'm thinking ITracer, as an homage to it's old platform.

And if we do that, we should then rename the other classes: TraceManager ITraceTarget ITracer

That should clear up the imports.

Here is how the Log classes work:

mikecann commented 8 years ago

Sounds good @prankard :)

prankard commented 8 years ago

Due to a much larger change that what I had intended, I decided to rename this to ILogging instead. Otherwise, all the framework methods and enums change like so:

traceTarget.Trace();
traceManager.GetTracer();
context.TraceLevel = TraceLevel.Debug;

Even thought it makes sense, it's very different from the original, and I want to keep it familiar with those who used the original framework.

So future use of logger:

class TestCommand
{
    [Inject] public ILogging logger;

    public void Execute()
    {
        logger.Warn("The logger injection rule has changed from ILogger to ILogging, please be aware");
    }
}