Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1403692
D550.id1419.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 25, 8:57 AM
Size
3 KB
Mime Type
text/x-diff
Expires
Thu, Feb 26, 8:57 AM (18 h, 31 m)
Engine
blob
Format
Raw Data
Handle
899811
Attached To
D550: INP-1931 - Color Log Level names in the System Log
D550.id1419.diff
View Options
Index: core/admin_templates/logs/system_logs/system_log_edit.tpl
===================================================================
--- core/admin_templates/logs/system_logs/system_log_edit.tpl
+++ core/admin_templates/logs/system_logs/system_log_edit.tpl
@@ -127,7 +127,13 @@
<inp2:m_RenderElement name="subsection" title="la_title_General"/>
<inp2:m_RenderElement name="inp_id_label" prefix="system-log" field="LogId" title="la_fld_Id"/>
<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogUniqueId"/>
- <inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogLevel"/>
+
+ <inp2:m_RenderElement design="form_row" prefix="system-log" field="LogLevel">
+ <td class="control-cell" style="<inp2:$prefix_LogLevelStyle/>" valign="top">
+ <inp2:$prefix_Field name="$field"/>
+ </td>
+ </inp2:m_RenderElement>
+
<inp2:m_RenderElement name="inp_label" prefix="system-log" field="LogType"/>
<inp2:m_if check="system-log_Field" name="LogCode" db="db">
Index: core/admin_templates/logs/system_logs/system_log_list.tpl
===================================================================
--- core/admin_templates/logs/system_logs/system_log_list.tpl
+++ core/admin_templates/logs/system_logs/system_log_list.tpl
@@ -106,6 +106,10 @@
</ol>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="grid_log_level_td">
+ <span style="<inp2:LogLevelStyle/>"><inp2:Field name="$field"/></span>
+</inp2:m_DefineElement>
+
<inp2:m_RenderElement name="grid" PrefixSpecial="system-log" IdField="LogId" grid="Default"/>
<script type="text/javascript">
Index: core/units/logs/system_logs/system_log_tp.php
===================================================================
--- core/units/logs/system_logs/system_log_tp.php
+++ core/units/logs/system_logs/system_log_tp.php
@@ -207,4 +207,30 @@
return str_replace(Array ('<?php ', '?>'), '', $string);
}
+
+ /**
+ * Returns "LogLevel" field CSS style based on its value.
+ *
+ * @param array $params Tag params.
+ *
+ * @return string
+ */
+ protected function LogLevelStyle(array $params)
+ {
+ static $colors = array(
+ kLogger::LL_ALERT => '#216d87',
+ kLogger::LL_CRITICAL => '#f40003',
+ kLogger::LL_ERROR => '#d7381e',
+ kLogger::LL_WARNING => '#c89d03',
+ kLogger::LL_NOTICE => '#762672',
+ kLogger::LL_DEBUG => '#39b54b',
+ );
+
+ /** @var kDBItem $object */
+ $object = $this->getObject($params);
+ $log_level = $object->GetDBField('LogLevel');
+
+ return array_key_exists($log_level, $colors) ? 'color: ' . $colors[$log_level] . ';' : '';
+ }
+
}
Index: core/units/logs/system_logs/system_logs_config.php
===================================================================
--- core/units/logs/system_logs/system_logs_config.php
+++ core/units/logs/system_logs/system_logs_config.php
@@ -209,7 +209,7 @@
'Fields' => Array (
'LogId' => Array ('title' => 'column:la_fld_Id', 'filter_block' => 'grid_range_filter', 'width' => 80),
'LogUniqueId' => Array ('filter_block' => 'grid_range_filter', 'width' => 100),
- 'LogLevel' => Array ('filter_block' => 'grid_options_filter', 'width' => 100),
+ 'LogLevel' => Array ('filter_block' => 'grid_options_filter', 'data_block' => 'grid_log_level_td', 'width' => 100),
'LogType' => Array ('filter_block' => 'grid_options_filter', 'width' => 80),
'LogCode' => Array ('filter_block' => 'grid_range_filter', 'width' => 80),
'LogMessage' => Array ('filter_block' => 'grid_like_filter', 'no_special' => 1, 'width' => 250),
Event Timeline
Log In to Comment