View Single Post
Old 08-30-2021, 11:26 AM
gregg gregg is offline
Registered User
Join Date: Oct 2010
Posts: 75
I think one way to accomplish this is to capture the current name, set new name, start log, reset name.

# $language = "Python"
# $interface = "1.0"

s = crt.Session
config = s.Config
orig_name = config.GetOption("Log Filename")
s.LogFileName = "my-new-file.log"
s.Log(True, True)
s.LogFileName = orig_name

# rest of script / terminal work
Changing the LogFileName after starting the log does not seem to affect the current log stream.

Note: had to use config.GetOption() to retain the raw "%S_%Y_%M%D" - because s.LogFileName returns the substituted name.

Last edited by gregg; 08-30-2021 at 11:39 AM. Reason: address % vars in log filename
Reply With Quote