Francois PIETTE wrote: >> The loDestxx options specify a destination, either to event, file >> or to OutputDebugString. > > Would be interesting to have output to system log and application log.
Do you mean Windows eventlog? > > -- > [EMAIL PROTECTED] > http://www.overbyte.be > > ----- Original Message ----- > From: "Arno Garrels" <[EMAIL PROTECTED]> > To: "ICS support mailing" <[email protected]> > Sent: Monday, December 26, 2005 12:08 PM > Subject: Re: [twsocket] Logging class for TWSocket > > >> Forgot to say that a base class eases conditional compile >> like: >> >> {$IFDEF NO_DEBUG_LOG} >> TIcsComponent = TComponent; >> {$ELSE} >> TIcsComponent = TIcsBaseLogComp; >> {$ENDIF} >> TCustomWSocket = class(TIcsComponent) >> private >> .. >> >> If you realy think it will make problems with derived classes >> I can change the code w/o using a base class of course. >> After you know the code of the base class are still believing >> it's a problem? >> >> Another thing is the categories and number of options available. >> I think having three different levels Err, Info, Dump >> for Wsocket, SSL and protocol specific logging should be enough, >> what do you think? >> >> The loDestxx options specify a destination, either to event, file >> or to OutputDebugString. >> >> Here's a screenshot of the logger linked to the SslHttpServer in object >> inspector. >> >> http://www.duodata.de/misc/ics_logger.png >> >> >> Arno Garrels wrote: >>> Francois PIETTE wrote: >>>>> A TIcsLogger could be linked to the ICS components >>>> >>>> Arno, >>>> >>>> I don't know how you intend to implement your logging classe but your >>>> last messages about compiler trouble make me thinking you are planning >>>> to >>>> change TWSocket base class to add logging feature. >>>> >>>> I don't think it is the right way to do it. It would probably cause a >>>> lot >>>> of trouble in many TWSocket derived classes. It is probably much better >>>> to add a property to TCustomWSocket, maybe : >>>> FLoggerClass : TIcsLogger; >>>> If this property is not assigned, the component behave as usual. If the >>>> property is assigned, the component start logging using the logger >>>> class. >>>> >>>> What do you think ? >>> >>> Yes exactly, this is what I've done a component TIcsLogger. >>> >>> *However, in order to save a lot duplicated code implementing the new >>> property "IcsLogger" I made in fact a new tiny base class, but so far >>> there's no problem with derived classes, base class below. >>> >>> >>> TIcsBaseLogComp = class(TComponent) >>> protected >>> FIcsLogger : TIcsLogger; >>> procedure SetIcsLogger(const Value : TIcsLogger); virtual; >>> procedure Notification(AComponent : TComponent; >>> Operation : TOperation); override; >>> public >>> procedure DebugLog(LogOption : TLogOption; >>> const Msg : string); virtual; >>> function CheckLogOptions(const LogOption: TLogOption): >>> Boolean; virtual; published >>> property IcsLogger : TIcsLogger read >>> FIcsLogger >>> write >>> SetIcsLogger; end; >>> >>> { TIcsLogComp } >>> >>> {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * >>> * *} >>> >>> function TIcsBaseLogComp.CheckLogOptions(const LogOption: TLogOption): >>> Boolean; begin >>> Result := Assigned(FIcsLogger) and (LogOption in >>> FIcsLogger.LogOptions); end; >>> >>> >>> {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * >>> * *} procedure TIcsBaseLogComp.DebugLog(LogOption: TLogOption; const >>> Msg: string); begin >>> if Assigned(FIcsLogger) then >>> if loAddStamp in FIcsLogger.FLogOptions then >>> FIcsLogger.DoDebugLog(Self, LogOption, >>> IcsLoggerAddTimeStamp + ' ' + Msg) >>> else >>> FIcsLogger.DoDebugLog(Self, LogOption, Msg); >>> end; >>> >>> >>> {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * >>> * *} procedure TIcsBaseLogComp.Notification(AComponent: TComponent; >>> Operation: TOperation); >>> begin >>> inherited Notification(AComponent, Operation); >>> if Operation = opRemove then begin >>> if AComponent = FIcsLogger then >>> FIcsLogger := nil; >>> end; >>> end; >>> >>> >>> {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * >>> * *} procedure TIcsBaseLogComp.SetIcsLogger(const Value: TIcsLogger); >>> begin >>> FIcsLogger := Value; >>> if Value <> nil then >>> Value.FreeNotification(Self); >>> end; >>> >>> >>> {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * >>> * *} >>> >>>> >>>> -- >>>> [EMAIL PROTECTED] >>>> http://www.overbyte.be >> -- >> To unsubscribe or change your settings for TWSocket mailing list >> please goto http://www.elists.org/mailman/listinfo/twsocket >> Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
