Simplify extension logger interface

By Igor Kirtak on 8 Jun 2015
There is a method used to log message from extension, and here is how it looks:

OutSystems.HubEdition.RuntimePlatform.Log.GeneralLog.Write(DateTime instant, string sessionId, int espaceId, int tenantId, int userId, string message, string messageType, string moduleName, string errorId);

This is too complex to use, and most of the parameters can be determined by the logger itself. Whenever I need to do logging, I spend some time finding what to fill there, and usually I write helper method with much simpler interface, like this:

private void Log(String message, String messageType)
        {
            var appInfo = AppInfo.GetAppInfo();
            new GeneralLog().Write(DateTime.Now, appInfo.OsContext.Session.SessionID, appInfo.eSpaceId, appInfo.Tenant.Id, appInfo.OsContext.Session.UserId,
                message, messageType, "ModuleName", "0");
        }

Please add this kind of overload to GeneralLog class so that it's easier to use for everyone.

I don't know if using "moduleName" parameter makes sense, maybe there should be another overload accepting it, same about the last "errorId".
And "messageType" -  this can be changed to enum, otherwise who knows what message types are available, or can just anything be used there? I also don't know if it's used at all - don't see it appearing in ServiceCenter.

I am with you on this one, I am currently trying to track down a null pointer exception in an extension I am writing and it is exceedingly difficult to do in OutSystems. The only salvation appears to be the ability to write to the logs in Service Studio, but even this is a proper level of difficult. At the very least, OutSystems needs to improve its documentation for writing extensions.