[twsocket] TIcsLogger proposal

2009-05-09 Thread Anton Sviridov
Arno, if you care about "slowing" string concatenations (although concatenation 
will be executed *anyway*: Time+Sep+Msg), then we could do something like this:

FDateFormat, FTimeFormat, FDateTimeFormat: string;
...
procedure SetDateTimeFormat(df, tf: string);
begin
  FDateFormat := df;
  FTimeFormat := tf;
  FDateTimeFormat := FDateFormat + FLogSep + FTimeFormat;
end;

and

procedure SetLogSep(ls: char);
begin
  FLogSep := ls;
  FDateTimeFormat := FDateFormat + FLogSep + FTimeFormat;
end;

- two methods are used to implement independence between format strings and log 
sep. Or, we really could just set DateTimeFormat as single string, not taking 
care about a separator between date and time. But also you should do something 
with code for .NET, to make output configurable too.
I sent Francois my modification of unit, it of course isn't ideal, but it's 
something to start from. Also there is a check of CR/LF in the end of logged 
line, to avoid doubling of these characters when Msg already contains them (FTP 
server responses, for example).

--
Regards, Anton
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TIcsLogger proposal

2009-05-08 Thread Francois PIETTE
 Francois, you're right, properties will go better. I'll be waiting
 for updates of Logger in SVN =)
>>>
>>> Won't it be much cleaner to just add a single property
>>> "TimeStampFormatString : String"? That covered everything and can be
>>> set to "hh:nn:ss:zzz " by default in order to maintain backwards
>>> compatibility.
>>
>> LogColumnSeparator is also useful.
>> It is clear that having a separate date format and time format is not
>> required. A single format string is enough because one can add the
>> LogColumnSeparator that format string (anyway, that's what Anton's
>> code do by concatenation dateformat, columnsep and time format).
>
> That's true, but concatenating strings is slow and should be avoided
> whenever possible. In Anton's change there are three properties to form
> a simple DataTime string including the separator, this should be
> simplified IMO.

Maybe I was not clear. I agree with you with a single format string for date 
and time. Nevertheless LogColumnSeparator is really useful. and should be 
kept.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TIcsLogger proposal

2009-05-08 Thread Arno Garrels
Piotr Dałek wrote:
> Hello!
> 
 That's true, but concatenating strings is slow and should be
 avoided whenever possible. In Anton's change there are three
 properties to form a simple DataTime string including the
 separator, this should be simplified IMO.
>>> 
>>> "Format" could be used instead of concatenation.
> 
>> Format is and has been always used. However the format string must
>> IMO not be concatenated before the call to FormatDateTime unless
>> speed doesn't matter.
> 
> Then concatenate it once in property's setter.

My suggestion above, does not require any concatenation.

--
Arno Garrels
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TIcsLogger proposal

2009-05-08 Thread Piotr Dałek
Hello!

>>> That's true, but concatenating strings is slow and should be avoided
>>> whenever possible. In Anton's change there are three properties to
>>> form a simple DataTime string including the separator, this should be
>>> simplified IMO.
>> 
>> "Format" could be used instead of concatenation.

> Format is and has been always used. However the format string must
> IMO not be concatenated before the call to FormatDateTime unless 
> speed doesn't matter.

Then concatenate it once in property's setter. 

-- 
Piotr Dałek
enigmati...@interia.pl

--
Dzwonki na komorkę!
Sprawdz >> http://link.interia.pl/f2152 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TIcsLogger proposal

2009-05-08 Thread Arno Garrels
Piotr Dałek wrote:
> Hello!
> 
>>> LogColumnSeparator is also useful.
>>> It is clear that having a separate date format and time format is
>>> not required. A single format string is enough because one can add
>>> the LogColumnSeparator that format string (anyway, that's what
>>> Anton's code do by concatenation dateformat, columnsep and time
>>> format). 
> 
>> That's true, but concatenating strings is slow and should be avoided
>> whenever possible. In Anton's change there are three properties to
>> form a simple DataTime string including the separator, this should be
>> simplified IMO.
> 
> "Format" could be used instead of concatenation.

Format is and has been always used. However the format string must
IMO not be concatenated before the call to FormatDateTime unless 
speed doesn't matter.

--
Arno Garrels 


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TIcsLogger proposal

2009-05-08 Thread Piotr Dałek
Hello!

>> LogColumnSeparator is also useful.
>> It is clear that having a separate date format and time format is not
>> required. A single format string is enough because one can add the
>> LogColumnSeparator that format string (anyway, that's what Anton's
>> code do by concatenation dateformat, columnsep and time format).

> That's true, but concatenating strings is slow and should be avoided
> whenever possible. In Anton's change there are three properties to form
> a simple DataTime string including the separator, this should be 
> simplified IMO.

"Format" could be used instead of concatenation. 

-- 
Piotr Dałek
enigmati...@interia.pl

--
Wygraj 3000 zl, wycieczke lub lot balonem!
Sprawdz >> http://link.interia.pl/f2154

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TIcsLogger proposal

2009-05-08 Thread Arno Garrels
Francois PIETTE wrote:
>>> Francois, you're right, properties will go better. I'll be waiting
>>> for updates of Logger in SVN =)
>> 
>> Won't it be much cleaner to just add a single property
>> "TimeStampFormatString : String"? That covered everything and can be
>> set to "hh:nn:ss:zzz " by default in order to maintain backwards
>> compatibility.
> 
> LogColumnSeparator is also useful.
> It is clear that having a separate date format and time format is not
> required. A single format string is enough because one can add the
> LogColumnSeparator that format string (anyway, that's what Anton's
> code do by concatenation dateformat, columnsep and time format).

That's true, but concatenating strings is slow and should be avoided
whenever possible. In Anton's change there are three properties to form
a simple DataTime string including the separator, this should be 
simplified IMO.

--
Arno Garrels


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TIcsLogger proposal

2009-05-08 Thread Francois PIETTE
>> Francois, you're right, properties will go better. I'll be waiting
>> for updates of Logger in SVN =)
>
> Won't it be much cleaner to just add a single property
> "TimeStampFormatString : String"? That covered everything and can be
> set to "hh:nn:ss:zzz " by default in order to maintain backwards
> compatibility.

LogColumnSeparator is also useful.
It is clear that having a separate date format and time format is not 
required. A single format string is enough because one can add the 
LogColumnSeparator that format string (anyway, that's what Anton's code do 
by concatenation dateformat, columnsep and time format).

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TIcsLogger proposal

2009-05-08 Thread Arno Garrels
Anton Sviridov wrote:
> Francois, you're right, properties will go better. I'll be waiting
> for updates of Logger in SVN =) 

Won't it be much cleaner to just add a single property 
"TimeStampFormatString : String"? That covered everything and can be
set to "hh:nn:ss:zzz " by default in order to maintain backwards
compatibility.

--
Arno Garrels

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TIcsLogger proposal

2009-05-07 Thread Francois Piette
Maybe you should download latest version from the SVN repository (all
version !), apply your changes, create a "diff" file and send the changes to
Arno and me.

--
francois.pie...@overbyte.be
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be

- Original Message - 
From: "Anton Sviridov" 
To: 
Sent: Thursday, May 07, 2009 11:07 AM
Subject: [twsocket] TIcsLogger proposal


> Francois, you're right, properties will go better. I'll be waiting for
updates of Logger in SVN =)
>
> --
> Regards, Anton
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] TIcsLogger proposal

2009-05-07 Thread Anton Sviridov
Francois, you're right, properties will go better. I'll be waiting for updates 
of Logger in SVN =)

--
Regards, Anton
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] TIcsLogger proposal

2009-05-06 Thread Francois PIETTE
Hello Anton,

Thanks for your proposal. The feature is interesting, but the implementation 
is not OK. Instead of global variables, it should be properties.

--
francois.pie...@overbyte.be
The author of the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be

- Original Message - 
From: "Anton Sviridov" 
To: 
Sent: Wednesday, May 06, 2009 12:14 PM
Subject: [twsocket] TIcsLogger proposal


>I have a little suggestion to improve TIcsLogger. The reason is that I wish 
>to have both date and time in logfile and don't care about millisecs.
> Also, I don't want to derive classes, override events and all that stuff, 
> just want to make output format customizable.
>
> 1) add public variable
>
> var TimeStampPattern: string = 'hh:nn:ss:zzz';
>
> 2) line
>DateTimeToString(Result, TimeStampPattern, Time);
> change to
>DateTimeToString(Result, TimeStampPattern, Now);
>
> 3) add piblic variable
>LogSep: Char = ' ';
>
> 4) in DoDebugLog replace ' ' by LogSep
>
> So in our Form we could do this:
>
> FormCreate()
> begin
>  TimeStampPattern := '/mm/dd'#9'hh:nn:ss';
>  LogSep := #9;
> end;
>
> and get logfiles with easy-to-recognize columns with data, time and 
> message fields.
>
> Also there's something to change in adding the new line symbols in case 
> when message already contains them.
>
> --
> Regards, Anton
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be 

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] TIcsLogger proposal

2009-05-06 Thread Anton Sviridov
I have a little suggestion to improve TIcsLogger. The reason is that I wish to 
have both date and time in logfile and don't care about millisecs.
Also, I don't want to derive classes, override events and all that stuff, just 
want to make output format customizable.

1) add public variable

var TimeStampPattern: string = 'hh:nn:ss:zzz';

2) line
DateTimeToString(Result, TimeStampPattern, Time);
change to
DateTimeToString(Result, TimeStampPattern, Now);

3) add piblic variable
LogSep: Char = ' ';

4) in DoDebugLog replace ' ' by LogSep

So in our Form we could do this:

FormCreate()
begin
  TimeStampPattern := '/mm/dd'#9'hh:nn:ss';
  LogSep := #9;
end;

and get logfiles with easy-to-recognize columns with data, time and message 
fields.

Also there's something to change in adding the new line symbols in case when 
message already contains them.

--
Regards, Anton
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be