Modify

Opened 2 months ago

Closed 6 weeks ago

#3765 closed Bug (Fixed)

_FileWriteLog

Reported by: RedZone Owned by: Jpm
Milestone: 3.3.15.4 Component: AutoIt
Version: 3.3.14.5 Severity: None
Keywords: _FileWriteLog Cc:

Description

$iFlag value does not work when $sLogPath = a file handle returned from FileOpen().

It appears that FileOpen()$mode=1$FO_APPEND (1) = Write mode (append to end of file) overrides _FileWriteLog $iFlag value.

In reference to this post

_FileWriteLog help file link
FileOpen help file link

Example:

#include <File.au3>
$hTest = fileopen("C:\temp\test.log", 1)
$sTestPath = "C:\temp\test.log"
;Test with handle
_FileWriteLog($hTest, "First Message")
_FileWriteLog($hTest, "Message at the End", -1)
_FileWriteLog($hTest, "Message at the Top", 1)
ShellExecute($sTestPath)
FileClose($hTest)

Result:
2020-06-07 10:54:16 : First Message
2020-06-07 10:54:16 : Message at the End
2020-06-07 10:54:16 : Message at the Top

#include <File.au3>
$hTest = fileopen("C:\temp\test.log", 1)
$sTestPath = "C:\temp\test.log"
;Test with handle
_FileWriteLog($sTestPath, "First Message")
_FileWriteLog($sTestPath, "Message at the End", -1)
_FileWriteLog($sTestPath, "Message at the Top", 1)
ShellExecute($sTestPath)
FileClose($hTest)

Result:
2020-06-07 10:55:58 : Message at the Top
2020-06-07 10:55:58 : First Message
2020-06-07 10:55:58 : Message at the End

Attachments (0)

Change History (2)

comment:1 Changed 2 months ago by Jpm

As when using Handle it will be needed to override the opening mode,
I prefer to change the doc to explain that with handle the $iFlag is ignored and so only apending will occurs

comment:2 Changed 6 weeks ago by Jpm

  • Milestone set to 3.3.15.4
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [12351] in version: 3.3.15.4

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jpm.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.