<cAppLog>.Console.Color

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Modules > AppLog > cAppLog Class > <cAppLog> Objects > <cAppLog>.Console >

<cAppLog>.Console.Color

 

Description

 

Allows change of color for the specified log level.

 

Syntax

 

' SET

<cAppLog>.Console.Color = logLevel, foregroundColor, backgroundColor

 

' GET

consoleColor = <cAppLog>.Console.Color(logLevel)

 

Returns

 

Color encoded as 32 bit number. See the example how to decode.

 

Parameters

 

Name

Type

Optional

Meaning

logLevel

Number

No

Please use one of the defined equates:

%appLog_Level_Trace

%appLog_Level_Debug

%appLog_Level_Info

%appLog_Level_Warn

%appLog_Level_Error

%appLog_Level_Fatal

 

foregroundColor

Number

No (SET)
Yes (GET)

Color of the text foreground in console.

Please use the console color equates.

 

backgroundColor

Number

No (SET)
Yes (GET)

Color of the text background in console.

Please use the console color equates.

 

 

Remarks

 

It does not require explicit use of the Console module.

 

Restrictions

 

See also

 

Examples

 

uses "AppLog"

 

dim myLog as new cAppLog

 

myLog.Console.Active   = %true

 

' Yellow text on red background

myLog.Console.Color = %APPLOG_LEVEL_ERROR%CColor_Yellow%CColor_LightRed

 

' Reading the value back (will be displayed as number)

msgbox 0, "Foreground: " + lo(integer, myLog.Console.Color(%APPLOG_LEVEL_ERROR)) + $CRLF +

          "Background: " + hi(integer, myLog.Console.Color(%APPLOG_LEVEL_ERROR)) 

 

myLog.Log.Trace("AppLog this is a Trace level text")

myLog.Log.Debug("AppLog this is a Debug level text")

myLog.Log.Info("AppLog this is a Info  level text")

myLog.Log.Warn("AppLog this is a Warn  level text")

myLog.Log.Error("AppLog this is a Error level text")

myLog.Log.Fatal("AppLog this is a Fatal level text")

 

sleep 1000