LazLogger: regression on --debug-log= option
- Lazarus/FPC Version: Lazarus 2.2.2 (rev lazarus_2_2_2) FPC 3.2.2 x86_64-win64-win32/win64
- Operating System: Windows 10 Pro 21H2 x64
- CPU / Bitness: 64-bit
What happens
Command line option --debug-log=test.log
isn't recognized properly, logging still goes to stdout.
What did you expect
LazLogger should log to the given filename instead.
Steps to reproduce
Create new Lazarus "Simple Program" project:
program logging;
{$APPTYPE CONSOLE}
{$DEFINE DEBUG}
uses
{$IFDEF DEBUG}
LazLoggerBase,
{$ENDIF}
LazLogger;
begin
{$IFDEF DEBUG}
debugln('Hello debug world!');
{$ENDIF}
end.
Compile and run (from console) logging --debug-log=test.log
- the program will still output to stdout.
**Note:**
Running logging --debug-log==test.log
(two =
!) will work, and actually logs to file.
Evaluation
It seems that commit 7a876814 changed GetParamByNameCount()
(lazloggerbase.pas) in a way that means that now the initialization FParamForLogFileName := '--debug-log=';
in TLazLoggerFile.Create
(lazlogger.pas) is incorrect. It should be FParamForLogFileName := '--debug-log';
instead, without the trailing =
.
Regards, NiteHawk
Edited by NiteHawk