nsmcp::LogRecordParser method stripAnsi (public)
<instance of nsmcp::LogRecordParser> stripAnsi message
Defined in /usr/local/ns/tcl/nsmcp/log-record.tcl
Remove recognized ANSI formatting from a system-log message. Initialize the color-code map lazily; return unformatted input without further transformation.
- Parameters:
- message (required)
- Diagnostic message text.
- Returns:
- The message with recognized ANSI codes removed.
- Testcases:
- No testcase defined.
Source code: if {[string first \x1b $message] < 0} { return $message } if {![info exists :colorCodeMap]} { set :colorCodeMap [list [binary decode hex 1b5b303b33326d] {} [binary decode hex 1b5b303b33396d] {} [binary decode hex 1b5b306d] {} [binary decode hex 1b5b313b33316d] {} [binary decode hex 1b5b313b33396d] {}] } set message [string map ${:colorCodeMap} $message] # Preserve support for uncommon/custom SGR sequences, off the fast path. if {[string first \x1b $message] >= 0} { regsub -all {\x1b\[[0-9;]*m} $message {} message } return $messageXQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)