Hi !!!
I want make the log in a html file.
For this, I´m trying:
First try:
TMSLogger.RegisterOutputHandler(TTMSLoggerHTMLOutputHandler.Create('C:\Clientes\TMSLoggintest\Win32\Debug\TMSLog.html'));
Second try:
TMSLogger.RegisterOutputHandlerClass(C:\Clientes\TMSLoggintest\Win32\Debug\TMSLog.html']);
There is no error in compillation, but when I´ll to register a log with the command:
"TMSLogger.Info('Test')" raises a error:
"Cannot create file
"C:\Clientes\TMSLoggintest\Win32\Debug"
But, if I execute this:
ShowMessage(TTMSLoggerHTMLOutputHandler(Handler).FileName), the file is there
Thanks.
wlandgraf
(Wagner Landgraf)
December 1, 2020, 10:23am
2
You can use it this way:
TMSLogger.RegisterManagedOutputHandler(TTMSLoggerHTMLOutputHandler.Create('C:\Clientes\TMSLoggintest\Win32\Debug\TMSLog.html', 'C:\Clientes\TMSLoggintest\Win32\Debug\TMSLog.js'));
or this way:
TMSLogger.RegisterOutputHandlerClass(TTMSLoggerHTMLOutputHandler, ['C:\Clientes\TMSLoggintest\Win32\Debug\TMSLog.html', 'C:\Clientes\TMSLoggintest\Win32\Debug\TMSLog.js']);
Hi. It´s doesn´t works.
The error
'Cannot Create File "C:\Clientes\TMSLoggintest\Win32\Debug\C:\Clientes\TMSLoggintest\Win32\Debug\TMSLog.js"
The project code is below:
implementation
uses
TMSLoggingCore, Bcl.TMSLogging, TMSLogging, TMSLoggingHTMLOutputHandler;
procedure TForm1.Button1Click(Sender: TObject);
var
s: string;
begin
s := 'Hello World !';
TMSLogger.Info(s);
TMSLogger.Error(s);
TMSLogger.Warning(s);
TMSLogger.Trace(s);
TMSLogger.Debug(s);
end;
procedure TForm1.FormCreate(Sender: TObject);
var cCaminho:String;
begin
cCaminho := ExtractFilePath(ParamStr(0));
RegisterTMSLogger;
TMSLogger.RegisterManagedOutputHandler(TTMSLoggerHTMLOutputHandler.Create(cCaminho+\TMSLog.html',
cCaminho+\TMSLog.js'));
// TMSLogger.RegisterOutputHandlerClass(TTMSLoggerHTMLOutputHandler, ['C:\Clientes\TMSLoggintest\Win32\Debug\TMSLog.html', 'C:\Clientes\TMSLoggintest\Win32\Debug\TMSLog.js']);
end;
Thanks.
wlandgraf
(Wagner Landgraf)
December 4, 2020, 1:05pm
4
I'm sorry, my mistake. The second parameter must only contain the .js
file name, without path:
TMSLogger.RegisterOutputHandlerClass(TTMSLoggerHTMLOutputHandler, ['C:\Clientes\TMSLoggintest\Win32\Debug\TMSLog.html', 'TMSLog.js']);
No problem!
Now, works fine!
Thank you!
1 Like
system
(system)
Closed
December 4, 2020, 9:04pm
6
This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.