Follow-up Comment #4, bug #33181 (project gnustep):
> Only if we added new API for this (or broke all existing code using the
library) ..
All right.
Currently the WebServerConnection class and WebServer`s -_audit method are
private.
So the behavior could not be changed without parsing and replacing passed
string or modifying library.
How about to split implementaion like below?
//---
WebServerConnection.m
- -(NSString*)audit
+ -(id)audit
{
NSDate *d;
NSString *h;
/* ... ( code set local variables is here) ... */
+ NSDictionary* info = [[NSDictionary
alloc]initWithObjectsAndKeys:h,@"host"
+ ,u,@"user", d , @"date", c, @"command", a, @"agent", r, @"result", nil];
+ id audit = [server provideAuditFor:info];
+ [info release];
+ return audit;
- return [NSStringClass stringWithFormat: @"%@ - %@ [%@] %@ %@
%@",h,u,d,c,a,r];
}
WebServer.m
+ -(id)provideAuditFor:(NSDictionary*)info
+ {
+ NSString* h = [info objectForKey:@"host"];
+ /* ... ( code to get other parts and put them into local vars) ... */
+ return [NSString stringWithFormat:@"%@ - %@ [%@] %@ %@ %@",h,u,d,c,a,r];
+}
//---
This will give a chance to create custom message with writing a subclass of
WebServer and override the method +provideAuditFor: .
Although this is a bit expensive and complex way, considering additional
information (cookie, env, other headers, etc) would be supported in future.
This is just an opinion . Please show us if you have any better idea.
Thanks anyway.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?33181>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
_______________________________________________
Bug-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-gnustep