Documentation for Functions Module¶
print_msg_box(msg, indent=1, width=None, title=None, logger_name=None)
¶
Prints a formatted message box to the logger with an optional title.
This function creates a visually appealing message box format for logging messages. It allows for indentation, custom width, and inclusion of a title. If the message is multiline, each line will be included in the box.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
msg
|
str
|
The message to be displayed inside the box. Must be a string. |
required |
indent
|
int
|
The number of spaces to indent the message box. Default is 1. |
1
|
width
|
int
|
The width of the message box. If not provided, it will be calculated based on the longest line of the message and the title (if provided). |
None
|
title
|
str
|
An optional title for the message box. Must be a string if provided. |
None
|
logger_name
|
str
|
The name of the logger to use. If not provided, the root logger will be used. |
None
|
Raises:
Type | Description |
---|---|
TypeError
|
If |
Returns:
Type | Description |
---|---|
None |
Notes
- The message box is bordered with decorative characters to enhance visibility in the logs.
- If the
width
is not provided, it will automatically adjust to fit the content.
Source code in nebula/addons/functions.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|