logopen

Causes Tera Term to start logging.

logopen <filename> <binary flag> <append flag> [<plain text flag> [<timestamp flag> [<hide dialog flag> [<include screen buffer flag> [<timestamp type]]]]]

Remarks

Received characters are written to the file <filename>.
When the file name has no folder, the log is saved in the default log folder of the log settings. If no default log folder is set, it is saved in the folder set by changedir, or else in the Documents folder.
Both '/' and '\' can be used as folder separators.

If <binary flag> is zero, received new-line characters are converted (CR -> CR/CRLF) and escape sequences are stripped out.
If <binary flag> is non-zero, received characters are written without any modifications.

If <append flag> is non-zero and the file <filename> already exists, received characters are appended to it.
If <append flag> is zero and the file <filename> already exists, the file is overwritten.

If <plain text flag> is not 0, ASCII non-printable characters are not written into log.
If <timestamp flag> is not 0, a timestamp is added on top of log.
If <binary flag> is non-zero, <plain text flag> and <timestamp flag> is ignored. The binary log file is available for Replay Log.

If <hide dialog flag> is not 0, "Log" dialog box is not displayed.

If <include screen buffer flag> is not 0, all current screen buffer is written into a log file in first.

<timestamp type> specifies timestamp type, and can be one of the following:

value Meaning
0 Local Time
1 UTC
2 Elapsed Time (Logging)
3 Elapsed Time (Connection)

If a log file is successfully opened, the system variable "result" is set to 0. Otherwise, the "result" is set to 1.

Example

connect '/C=1'

; get a user name
getenv 'USER' username
; get the date and time
gettime timestr "%Y%m%d-%H%M%S"

; add the user name and the timestamp to the log file name
sprintf2 filename 'console_%s_%s.log' username timestr

; change the current directory
changedir '/Users/user/Desktop'

logopen filename 0 0
logwrite 'Log start'#13#10
logwrite '*****************************************************'#13#10
logclose

end
;
; PowerCycle with logging
;

getenv 'USER' username
gettime timestr "%Y%m%d-%H%M%S"
getdir mdir
sprintf2 filename '%s/console_%s_%s.log' mdir username timestr

logopen filename 0 0

step = 0
while 1
  call show_step
  sendln 'echo do something'
  wait '$'
  pause 2
endwhile

logclose
end

:show_step
step = step + 1
gettime timestr
sprintf2 str '[%d] %s' step timestr
statusbox str 'counter'
return

See also