Skip to content

Commit

Permalink
Issue #413: Output bee_messages as text rather than table (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
yorkshire-pudding authored Jul 30, 2024
1 parent b48206f commit 5b65b7b
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions includes/render.inc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ function bee_print_messages() {
return;
}

// Add a new line before starting.
echo "\n";

// Style each type of message differently.
foreach ($_bee_messages as $type => $type_messages) {
// Skip 'log' messages if `debug` mode is disabled.
Expand All @@ -24,27 +27,17 @@ function bee_print_messages() {

list($symbol, $color) = bee_message_type_info($type);

// Prepare `$rows` array for table output.
// Output the symbol and text for each message.
foreach ($type_messages as $message) {
$rows[] = array(
array(
'value' => $symbol,
'#color' => $color,
'#bold' => TRUE,
),
array('value' => $message),
);
echo bee_format_text(" $symbol", $color) . " $message";

// Add a newline after each message.
echo "\n";
}
}

// Render messages in a table.
// Add a new line after the messages.
echo "\n";
bee_render_table(array(
'rows' => $rows,
'delimiter' => ' ',
'delimiter_left' => ' ',
'delimiter_right' => ' ',
));
}

/**
Expand Down

0 comments on commit 5b65b7b

Please sign in to comment.