#1 2025-05-13 08:26:21

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 549

Simple Question for new DoLog/Enter

Hi Arnaud i have a may be stupid question how to handle your Change in TSynLog.DoLog/Enter in our Programs

you changed one Parameter from RawUtf8 to PUtf8Char

what is the best way to fix the Compiler Errors:

Sample 1:

old:
var XYZ: String := 'test'; // Sometimes we got String Var
TSynLog.Enter(StringToUtf8(XYZ), ...);
new:
TSynLog.Enter(PUtf8Char(StringToUtf8(XYZ)), ...);  // is this the best way ?

Im not sure what this cast really does smile


Rad Studio 12.3 Athens

Offline

#2 2025-05-13 10:26:05

danielkuettner
Member
From: Germany
Registered: 2014-08-06
Posts: 388

Re: Simple Question for new DoLog/Enter

The best way is not to use TSynLog.Enter(...
Instead use:

var
  aLog: ISynLog;
begin
  aLog:= TSynLog.Enter(Self); //this is the first line before any other log
  aLog.Log(sslInfo, ...

Offline

#3 Today 09:19:17

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 549

Re: Simple Question for new DoLog/Enter

TY Daniel, this makes sense if you like to add something else to the Log.
My Question was concerning the Use of the Cast to PUtf8Char


Rad Studio 12.3 Athens

Offline

#4 Today 11:10:51

tbo
Member
Registered: 2015-04-20
Posts: 361

Re: Simple Question for new DoLog/Enter

itSDS wrote:

My Question was concerning the Use of the Cast to PUtf8Char

Defined as: "class function TSynLog.Enter(const TextFmt: RawUtf8; ...", then "TSynLog.Enter(StringToUtf8(XYZ), ...".
Defined as: "class function TSynLog.Enter(const TextFmt: PUtf8Char; ...", then "TSynLog.Enter(PUtf8Char(StringToUtf8(XYZ)), ..." or "TSynLog.Enter(Pointer(StringToUtf8(XYZ)), ...".

With best regards
Thomas

Last edited by tbo (Today 11:30:19)

Offline

Board footer

Powered by FluxBB