Skip to content

Log

QuantConnect.Logging.Log

Bases: Object

Logging management class.

log_handler

log_handler: ILogHandler

Gets or sets the ILogHandler instance used as the global logging implementation.

debugging_enabled

debugging_enabled: bool

Global flag whether to enable debugging logging:

file_path

file_path: str

Global flag to specify file based log path

debugging_level

debugging_level: int

Set the minimum message level:

error

error(
    error: str,
    override_message_flood_protection: bool = False,
) -> None
error(
    exception: Exception,
    message: str = None,
    override_message_flood_protection: bool = False,
) -> None
error(
    format: str, *args: Union[Object, Iterable[Object]]
) -> None

Signature descriptions:

  • Log error

  • Writes the message in red

Parameters:

Name Type Description Default
error Optional[str]

String Error

None
override_message_flood_protection Optional[bool]

Force sending a message, overriding the "do not flood" directive

False
exception Optional[Exception]

The exception to be logged

None
message Optional[str]

An optional message to be logged, if null/whitespace the messge text will be extracted

None

trace

trace(
    trace_text: str,
    override_message_flood_protection: bool = False,
) -> None
trace(
    format: str, *args: Union[Object, Iterable[Object]]
) -> None

Signature descriptions:

  • Log trace

  • Writes the message in normal text

clear_lean_paths

clear_lean_paths(error: str) -> str

Helper method to clear undesired paths from stack traces

Parameters:

Name Type Description Default
error str

The error to cleanup

required

Returns:

Type Description
str

The sanitized error.

debug

debug(text: str, level: int = 1) -> None

Output to the console

Parameters:

Name Type Description Default
text str

The message to show

required
level int

debug level

1

var_dump

var_dump(obj: Any, recursion: int = 0) -> str

C# Equivalent of Print_r in PHP:

Parameters:

Name Type Description Default
obj Any
required
recursion int
0