Wish "Not in Reelease" keyword

Cableguy

Expert
Licensed User
Longtime User
Hi EREL,

I know we already can exclude/condition code Blocks from compiling...

But a keyword that would render the inline code NOT to compile into release would be very useful.

I am one of those who like to place many LOG messages just to make sure things are what I need them to be, but then when compiling into release I need to go through all my code just to delete them.
 

DonManfred

Expert
Licensed User
Longtime User
I am one of those who like to place many LOG messages just to make sure things are what I need them to be, but then when compiling into release I need to go through all my code just to delete them.

You can use a code module with a custom logger... You can use conditional compiling in this sub to noch include the log-commands in release mode

B4X:
Type=StaticCode
Version=3.82
B4A=true
@EndOfDesignText@
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
   
    'Log(DateTime.Date(DateTime.Now))
    'Log(DateTime.Time(DateTime.Now))

    Public logError = 1
    Public logWarning = 2
    Public logNotice = 4
    Public logDebug = 8
    Public logSub = 16

End Sub
Sub MyLog(LogType As Int, text As String)
    Select LogType
    Case logError
        LogColor("  Error: "&text,Colors.Red)
    Case logWarning
        LogColor("Warning: "&text,Colors.ARGB(255,255,140,0))
    Case logNotice
        LogColor(" Notice: "&text,Colors.Blue)
    Case logDebug
        LogColor("  Debug: "&text,Colors.ARGB(255,139,0,0))
    Case logSub
        LogColor("    Sub: "&text,Colors.ARGB(255,139,0,0))
    End Select   
End Sub
 

Cableguy

Expert
Licensed User
Longtime User
That takes 3 lines to do one log...
Maybe a inline "#Debug" feature could be implemented
 
Last edited:
Top