Skip to main content

Mojo struct

Level

struct Level

Represents logging severity levels.

Defines the available logging levels in ascending order of severity.

Implemented traits

AnyType, Copyable, Movable, Stringable, UnknownDestructibility, Writable

Aliases

CRITICAL

alias CRITICAL = Level(50)

A serious error indicating that the program itself may be unable to continue running.

DEBUG

alias DEBUG = Level(10)

Detailed information, typically of interest only when diagnosing problems.

ERROR

alias ERROR = Level(40)

Due to a more serious problem, the software has not been able to perform some function.

INFO

alias INFO = Level(20)

Confirmation that things are working as expected.

NOTSET

alias NOTSET = Level(0)

Lowest level, used when no level is set.

WARNING

alias WARNING = Level(30)

Indication that something unexpected happened, or may happen in the near future.

Methods

__lt__

__lt__(self, other: Self) -> Bool

Returns True if this level is less than the other level.

Args:

  • other (Self): The level to compare with.

Returns:

Bool: True if this level is less than the other level, False otherwise.

__le__

__le__(self, other: Self) -> Bool

Returns True if this level is less than or equal to the other level.

Args:

  • other (Self): The level to compare with.

Returns:

Bool: True if this level is less than or equal to the other level, False otherwise.

__eq__

__eq__(self, other: Self) -> Bool

Returns True if this level equals the other level.

Args:

  • other (Self): The level to compare with.

Returns:

Bool: True if the levels are equal, False otherwise.

__ne__

__ne__(self, other: Self) -> Bool

Returns True if this level does not equal the other level.

Args:

  • other (Self): The level to compare with.

Returns:

Bool: True if the levels are not equal, False otherwise.

__gt__

__gt__(self, other: Self) -> Bool

Returns True if this level is greater than the other level.

Args:

  • other (Self): The level to compare with.

Returns:

Bool: True if this level is greater than the other level, False otherwise.

__ge__

__ge__(self, other: Self) -> Bool

Returns True if this level is greater than or equal to the other level.

Args:

  • other (Self): The level to compare with.

Returns:

Bool: True if this level is greater than or equal to the other level, False otherwise.

__is__

__is__(self, other: Self) -> Bool

Returns True if this level is identical to the other level.

Args:

  • other (Self): The level to compare with.

Returns:

Bool: True if this level is identical to the other level, False otherwise.

__isnot__

__isnot__(self, other: Self) -> Bool

Returns True if this level is not identical to the other level.

Args:

  • other (Self): The level to compare with.

Returns:

Bool: True if this level is not identical to the other level, False otherwise.

write_to

write_to[W: Writer](self, mut writer: W)

Writes the string representation of this level to a writer.

Parameters:

  • W (Writer): The writer type that implements the Writer trait.

Args:

  • writer (W): The writer to write to.

__str__

__str__(self) -> String

Returns the string representation of this level.

Returns:

String: A human-readable string representation of the level (e.g., "DEBUG", "INFO").

__repr__

__repr__(self) -> String

Returns the detailed string representation of this level.

Returns:

String: A string representation including the type name and level value (e.g., "Level.DEBUG").

Was this page helpful?