Class ::nsmcp::LogSummaryReader

::nsmcp::LogSummaryReader[i] create ... \
           [ -buffer (default "") ] \
           [ -channel:required channel:required ] \
           [ -index (default "0") ] \
           [ -limit:required limit:required ] \
           [ -lookahead (default "") ] \
           [ -maxBytes:required maxBytes:required ] \
           [ -offset:required offset:required ]

Defined in /usr/local/ns/tcl/nsmcp/log-summary.tcl

Class Relations

  • class: ::nx::Class[i]
  • superclass: ::nx::Object[i]
::nx::Class create ::nsmcp::LogSummaryReader \
     -superclass ::nx::Object

Methods (to be applied on instances)

  • next (scripted, public)

     <instance of nsmcp::LogSummaryReader[i]> next

    Testcases:
    No testcase defined.
    if {${:lookahead} ne ""} {
        set line ${:lookahead}
        set :lookahead {}
    } else {set line [:line]}
    if {$line eq ""} {error "unexpected end of system log during summary scan"}
    set event [dict create offset [dict get $line start] endOffset [dict get $line end]  message [dict get $line text] truncated [dict get $line truncated] complete false]
    while {${:offset}<${:limit}} {
        set line [:line]
        if {$line eq ""} break
        if {![::nsmcp::logRecordParser continuation [dict get $event message] [dict get $line text]]} {
            set :lookahead $line
            dict set event complete true
            return $event
        }
        set text "\n[dict get $line text]"
        set room [expr {max(0,${:maxBytes}-[string length [dict get $event message]])}]
        if {[string length $text]>$room || [dict get $line truncated]} {dict set event truncated true}
        if {$room>0} {dict append event message [string range $text 0 [expr {$room-1}]]}
        dict set event endOffset [dict get $line end]
    }
    return $event