nsmcp::QuestionService method recordUsage (protected)

 <instance of nsmcp::QuestionService[i]> recordUsage record turn

Defined in /usr/local/ns/tcl/nsmcp/question-service.tcl

Called under the existing question-service mutex, including rotation.

Parameters:
record (required)
turn (required)

Testcases:
No testcase defined.
Source code:
set path [file join ${:evidenceDirectory} token-usage.jsonl]
set line [::nsmcp::usageRecordJson [::nsmcp::usageRecord $record $turn [clock seconds]]]
if {[string bytelength $line] > 16384} {error "token usage record exceeds limit"}
if {[file exists $path] && [file size $path]+[string bytelength $line]+1 > 4194304} {
    file rename -force $path ${path}.1
}
set channel [open $path {WRONLY CREAT APPEND} 0600]
try {fconfigure $channel -encoding utf-8 -translation lf; puts $channel $line} finally {close $channel}
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: