Journal
Relevant module: edelweissfe.journal.journal
The journal writes two kinds of output, in two columns: the message on the left, its sender on the right.
- Messages
message()is for text. Lines longer than the message column are wrapped, and only the first line carries the sender.- Preformatted lines
preformatted()is for lines whose layout carries meaning, such as the rows of a table. They are never wrapped: a line longer than the message column pushes the sender to the right instead. Every line carries the sender. The iteration table of the implicit solvers is written this way, seeedelweissfe.solvers.base.convergencetable.
The level of a message is its nesting depth in the log, and it follows where the message is written:
- Level 0
The job: model setup and summaries.
- Level 1
An increment: its header, the convergence verdict, cutbacks, monitors, model modifiers such as adaptive refinement, and restart checkpoints.
- Level 2
Inside an increment: equation-system rebuilds, the iteration table, linear solver output, contact status.
A warning keeps the level of the place it is raised and is marked WARNING: or ⚠ instead of being
moved out to level 0. The implicit solvers open each increment’s block with a separator line before the topology
update, so refinement and contact output head the increment they belong to.
This module provides journaling capabilities, which can be used troughout EdelweissFE.
- class edelweissfe.journal.journal.Journal(verbose=True, outputFile=None, suppressFromLevel=3)[source]
This class provides an interface to present messages to the user via console output and/or file output. Information messages can be sorted by the importance level. Suppressing certain levels of output is possible.
- Parameters:
verbose (bool) – Print to the terminal.
outputFile (str) – Write to a file.
suppressFromLevel (int) – Suppress certain levels.
Methods
errorMessage(errorMessage, senderIdentification)Print an error message.
framedMessage(message, senderIdentification, ...)Write a message inside a frame, a block that stands apart from the lines around it.
message(message, senderIdentification[, level])Write message to log.
preformatted(lines, senderIdentification[, ...])Write lines whose layout must be kept, such as the rows of a table, to log.
Write a seperation file to log.
printTable(table, senderIdentification[, ...])Print a pretty table.
setNewLineWidth([newWidth, leftColumn])Set the line width of the log file.
Set highest verbosity.
squelch(level)Suppress all messages.
printPrettyTable
setFileOutput
- classmethod setNewLineWidth(newWidth=100, leftColumn=80)[source]
Set the line width of the log file.
- Parameters:
newWidth (int) – New total width.
leftColumn (int) – Width of the main column.
- errorMessage(errorMessage, senderIdentification)[source]
Print an error message.
- Parameters:
errorMessage (str) – The message.
senderIdentification (str) – The name of the sender.
- framedMessage(message, senderIdentification, title, level=1)[source]
Write a message inside a frame, a block that stands apart from the lines around it. The frame is as wide as the message column. A line longer than the frame is wrapped below itself, its continuation indented under its own text, and the
│of a tree drawn with├─and└─carried on, so that such a tree stays readable. The sender is on the first line only.- Parameters:
message (str) – The message; a line break starts a new line of the frame.
senderIdentification (str) – The name of the sender.
title (str) – The title in the upper border of the frame.
level (int) – Level of message.
- message(message, senderIdentification, level=1)[source]
Write message to log. Lines longer than the message column are wrapped.
- Parameters:
message (str) – The message.
senderIdentification (str) – The name of the sender.
level (int) – Level of message.
- preformatted(lines, senderIdentification, level=1)[source]
Write lines whose layout must be kept, such as the rows of a table, to log. They are never wrapped: a line longer than the message column pushes the sender to the right instead. Each line carries the sender.
- Parameters:
lines (list[str]) – The lines.
senderIdentification (str) – The name of the sender.
level (int) – Level of message.
- printTable(table, senderIdentification, level=1, printHeaderRow=True)[source]
Print a pretty table.
- Parameters:
table (list[list[str]]) – The table as nested list.
senderIdentification (str) – The name of the sender.
level (int) – The level of the mesage.
printHeaderRow (bool) – Special formatting for first row.