Wish Logging / colors

Controller

Member
Licensed User
Longtime User
Regarding logging, following features would be nice:
* Custom "tag" suffix for log filtering; Filtering options: "Current project" and "All B4A apps" (= all starting with B4A prefix)
* LogE/LogI/LogV/LogW functions (not that important, as can be quite easily implemented using reflection)
* Coloring in the debug log according to "prioriy constant" instead of log text prefixes like ~i:

BTW
B4X:
Public Sub LogW(xText As String)
    Dim xRef1 As Reflector
    Dim xChar1 As String
    xChar1 = "B4A"
    xRef1.RunStaticMethod("android.util.Log", "w", Array As Object(xChar1, xText), Array As String("java.lang.String", "java.lang.String"))
    End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Colored log is already possible with logcolor()
You can build your own logging...
B4X:
Sub Process_Globals
    Public logError = 0
    Public logWarning = 1
    Public logNotice = 2
    Public logDebug = 3   
End Sub
Sub MyLog(LogType As Int, text As String)
    Select LogType
    Case 0
        LogColor("  Error: "&text,Colors.Red)
    Case 1
        LogColor("Warning: "&text,Colors.ARGB(255,255,140,0))
    Case 2
        LogColor(" Notice: "&text,Colors.Blue)
    Case 3
        LogColor("  Debug: "&text,Colors.ARGB(255,139,0,0))
    End Select   
End Sub
Sub Activity_Create(FirstTime As Boolean)
    MyLog(logError,"Error bla")
    MyLog(logWarning," bla")
    MyLog(logNotice," bla")
    MyLog(logDebug," bla")
End Sub
but maybe i missunderstood the wish of colored log. If so then sorry
 
Top