Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!usc!ucsd!rutgers!att!cbnewsm!oh/cbh/cbnewsm!jhpb From: jhpb@granjon.ATT.COM (59452-JH Buehler(BLU123)) Newsgroups: comp.lang.c Subject: Re: Message-ID: Date: 4 May 90 18:13:40 GMT References: <11290@hoptoad.uucp> <40628@cornell.UUCP> <7377@crdgw1.crd.ge.com> <1990May4.161910.1353@cs.columbia.edu> Sender: jhpb@cbnewsm.ATT.COM Reply-To: jhpb@granjon.att.com (59452-JH Buehler(BLU123)) Followup-To: comp.lang.c Organization: AT&T Bell Laboratories, Liberty Corner, NJ Lines: 22 In-reply-to: travis@cs.columbia.edu's message of 4 May 90 16:19:10 GMT I usually use a varargs routine, which in turn uses vsprintf(). This lets me put what arguments in I like, and gets rid of the double parentheses required in the #define solutions for similar functionality. To get rid of the function calls when they're not needed, you can use the #define trick and let the compiler optimize the function calls out. e.g., #ifdef DEBUG # define LOG log #else # define LOG if (0) log #endif LOG(level, "example %d", 1); The log() I use puts in a time stamp, the process id, makes funny characters visible, and writes it to a log file that gets renamed elsewhere when the ulimit is hit. Joe Buehler