Logo GenPRES

ConsoleWriter Module

Writes plain, info, warning, error, debug and question messages to the console in colors. Each message is written under one lock, so messages from concurrent threads do not mix. A debug message is written only when the setting GENPRES_DEBUG is 1.

Types and nested modules

Type/Module Description

Flip

Holds the console message functions with the message text as the last argument.

NewLineNoTime

Holds the console message functions writing a message as a line without the current time.

NewLineTime

Holds the console message functions writing a message as a line with the current time in front.

Colors

Segment

A piece of text with the colours it is written in.

Functions and values

Function or value Description

ConsoleWriter.colors

Full Usage: ConsoleWriter.colors

Returns: Colors
Returns: Colors

ConsoleWriter.messageSegments time symbol label text

Full Usage: ConsoleWriter.messageSegments time symbol label text

Parameters:
Returns: Segment list

Returns the segments of a message: the time, when there is one, the symbol, the label, a space and the text.

time : DateTime option
symbol : string
label : Segment
text : Segment
Returns: Segment list

ConsoleWriter.segment frontColor backColor text

Full Usage: ConsoleWriter.segment frontColor backColor text

Parameters:
Returns: Segment

Returns the segment of a text in the given colours.

frontColor : ConsoleColor
backColor : ConsoleColor
text : string
Returns: Segment

ConsoleWriter.setColors frontColor backgroundColor

Full Usage: ConsoleWriter.setColors frontColor backgroundColor

Parameters:

Set the colors for the console

frontColor : ConsoleColor
backgroundColor : ConsoleColor

ConsoleWriter.standardSegment

Full Usage: ConsoleWriter.standardSegment

Returns: string -> Segment

Returns the segment of a text in the standard colours.

Returns: string -> Segment

ConsoleWriter.startSegments time symbol

Full Usage: ConsoleWriter.startSegments time symbol

Parameters:
    time : DateTime option
    symbol : string option

Returns: Segment list

Returns the segments that start a text: the time, when there is one, then the symbol, when there is one. Both are in the standard colours.

time : DateTime option
symbol : string option
Returns: Segment list

ConsoleWriter.timeToWrite writeTime

Full Usage: ConsoleWriter.timeToWrite writeTime

Parameters:
    writeTime : bool

Returns: DateTime option

Returns the current time when writeTime is true.

writeTime : bool
Returns: DateTime option

ConsoleWriter.writeColoredText symbol text frontColor backgroundColor writeLine writeCurrentTime

Full Usage: ConsoleWriter.writeColoredText symbol text frontColor backgroundColor writeLine writeCurrentTime

Parameters:
    symbol : string option
    text : string
    frontColor : ConsoleColor
    backgroundColor : ConsoleColor
    writeLine : bool
    writeCurrentTime : bool

symbol : string option
text : string
frontColor : ConsoleColor
backgroundColor : ConsoleColor
writeLine : bool
writeCurrentTime : bool

ConsoleWriter.writeColoredTextWithStandardBackColor text frontColor writeLine writeCurrentTime

Full Usage: ConsoleWriter.writeColoredTextWithStandardBackColor text frontColor writeLine writeCurrentTime

Parameters:
    text : string
    frontColor : ConsoleColor
    writeLine : bool
    writeCurrentTime : bool

text : string
frontColor : ConsoleColor
writeLine : bool
writeCurrentTime : bool

ConsoleWriter.writeDebugMessage text arg2 writeTime

Full Usage: ConsoleWriter.writeDebugMessage text arg2 writeTime

Parameters:
    text : string
    arg1 : bool
    writeTime : bool

text : string
arg1 : bool
writeTime : bool

ConsoleWriter.writeErrorMessage text writeLine writeTime

Full Usage: ConsoleWriter.writeErrorMessage text writeLine writeTime

Parameters:
    text : string
    writeLine : bool
    writeTime : bool

text : string
writeLine : bool
writeTime : bool

ConsoleWriter.writeInfoMessage text writeLine writeTime

Full Usage: ConsoleWriter.writeInfoMessage text writeLine writeTime

Parameters:
    text : string
    writeLine : bool
    writeTime : bool

text : string
writeLine : bool
writeTime : bool

ConsoleWriter.writeQuestionMessage text writeLine writeTime

Full Usage: ConsoleWriter.writeQuestionMessage text writeLine writeTime

Parameters:
    text : string
    writeLine : bool
    writeTime : bool

text : string
writeLine : bool
writeTime : bool

ConsoleWriter.writeSegments writeLine segments

Full Usage: ConsoleWriter.writeSegments writeLine segments

Parameters:
    writeLine : bool
    segments : Segment seq

Writes the segments to the console one after the other, each in its colours, and ends the line when writeLine is true. The segments are written under one lock, so text that another thread writes with this module never lands between them.

writeLine : bool
segments : Segment seq

ConsoleWriter.writeText text writeLine writeTime

Full Usage: ConsoleWriter.writeText text writeLine writeTime

Parameters:
    text : string
    writeLine : bool
    writeTime : bool

text : string
writeLine : bool
writeTime : bool

ConsoleWriter.writeWarningMessage text arg2 writeTime

Full Usage: ConsoleWriter.writeWarningMessage text arg2 writeTime

Parameters:
    text : string
    arg1 : bool
    writeTime : bool

text : string
arg1 : bool
writeTime : bool

Type something to start searching.