;************************ ;* Library : lhs_sys_debug_wrapper.pbi ;* ;* Wrapps Debug Messages PureBasic Default Debug, lhs_log and lhs_log_ext ;* ;* Created and develobed by Linder Hard- und Software ;* ;* EnableExplicit DeclareModule ldl Declare Logging(Output.s = "", UUID.s = "", Type.i = 0) Declare Register(Function.i, UUID.s = "", Debugger.i = 0,LoggerUUID.s = "", LogType.i = 0 ) Declare UnRegister(UUID.s = "") Declare IsRegistered(UUID.s = "") Declare SetDefault(UUID.s) Enumeration LogingFunction #Default #SimpleLog #SimpleLog_Type #AdvancedLog #AdvancedLog_Type EndEnumeration EndDeclareModule Module ldl Structure ldl_Typed UUID.s Final_UUID.s LogType.i Debugger.i LogingFunction.i EndStructure Global DefaultUUID.s = "" Global NewMap Logger.ldl_Typed() Prototype.i Default_Debug(Output.s) Prototype.i Simple_Log(Output.s, debugger.i = 0) Prototype.i Simple_Log_Type(LogType.i, ToLog.s, debugger.i = 0) Prototype.i Advanced_Log(UUID.s, ToLog.s, debugger.i = 0) Prototype.i Advanced_Log_Type(UUID.s, LogType.i, ToLog.s, debugger.i = 0) Procedure Logging(Output.s = "", UUID.s = "", Type.i = 0) If UUID = "" And DefaultUUID = "" Debug Output ProcedureReturn #True ElseIf UUID = "" And DefaultUUID <> "" UUID = DefaultUUID EndIf If IsRegistered(UUID) Select Logger(UUID)\LogType Case #SimpleLog Define.Simple_Log Simple = Logger(UUID)\LogingFunction Simple(Output, Logger(UUID)\Debugger) Case #SimpleLog_Type Define.Simple_Log_Type Simple_Type = Logger(UUID)\LogingFunction Simple_Type(Logger(UUID)\LogType, Output, Logger(UUID)\Debugger) Case #AdvancedLog Define.Advanced_Log Advanced = Logger(UUID)\LogingFunction Advanced(Logger(UUID)\Final_UUID, Output, Logger(UUID)\Debugger) Case #AdvancedLog_Type Define.Advanced_Log_Type Advanced_Type = Logger(UUID)\LogingFunction Advanced_Type(Logger(UUID)\Final_UUID, Logger(UUID)\LogType, Output, Logger(UUID)\Debugger) Default Debug Output EndSelect Else Debug Output EndIf EndProcedure Procedure Register(Function.i, UUID.s = "", Debugger.i = 0,LoggerUUID.s = "", LogType.i = 0 ) If Not IsRegistered(UUID.s) Logger(UUID)\Debugger = Debugger If LoggerUUID = "" Logger(UUID)\Final_UUID = UUID Else Logger(UUID)\Final_UUID = LoggerUUID EndIf Logger(UUID)\LogingFunction = Function Logger(UUID)\LogType = LogType Logger(UUID)\UUID = UUID ;ToDo: Verification LogType ProcedureReturn #True Else ProcedureReturn #False EndIf EndProcedure Procedure UnRegister(UUID.s = "") If IsRegistered(UUID) DeleteMapElement(Logger(), UUID) ProcedureReturn #True Else ProcedureReturn #False EndIf EndProcedure Procedure IsRegistered(UUID.s = "") If FindMapElement(Logger(), UUID) ProcedureReturn #True Else ProcedureReturn #False EndIf EndProcedure Procedure SetDefault(UUID.s) DefaultUUID = UUID EndProcedure EndModule