Re: Re[2]: [logs] Logging: World Domination

From: marc (marcat_private)
Date: Tue Aug 27 2002 - 03:50:07 PDT

  • Next message: Darren Reed: "Re: Re[2]: [logs] Logging: World Domination"

    > 5) Replace syslog(3) with
    > 
    > int newsyslog(unsigned int logfieldcount, struct field *logfields, unsigned int varfieldcount, struct field *varfields);
    > 
    >    where logfields and varfields are arrays of structures and logfieldcount
    >    and varfield count determine the number of fields in logfields and
    >    varfields.  struct field would be
    > 
    > struct field {
    > 	unsigned char *name;
    > 	unsigned char *value;
    > 	unsigned int name_length;
    > 	unsigned int value_length;
    > };
    > 
    
    Would it not be simpler to use variadic arguments, since that 
    doesn't require the programmer to set up several arrays of structures - or
    do you think that the potential for a very long parameter list is 
    a significant disadvantage ? Eg the prototype:
    
      int newsyslog(char *required_field1, char *required_field2, ...);  /* [1] */
    
    and then use:
    
      newsyslog("foo", "bar", "optional_field1", "baz", "optional_field2", "bang", N
    ULL);
    
    I have used something like this for my logging+refmon infrastructure [2], in
    the hope of making it as easy as possible for the programmer to report things.
    
    regards
    
    marc
    
    [1] ignoring your length specifiers, though there shouldn't be any 
        reason why they couldn't be included.
    [2] example toward the end of jade.cs.uct.ac.za/idsa/api.html
    _______________________________________________
    LogAnalysis mailing list
    LogAnalysisat_private
    http://lists.shmoo.com/mailman/listinfo/loganalysis
    



    This archive was generated by hypermail 2b30 : Tue Aug 27 2002 - 09:23:30 PDT