From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ig0-f171.google.com ([209.85.213.171]) by ur; Wed Feb 10 00:08:31 EST 2016 Received: by mail-ig0-f171.google.com with SMTP id mw1so7022837igb.1 for <9front@9front.org>; Tue, 09 Feb 2016 21:08:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=LQL0DKsOtk+iizoMcZiglxI8x/B+r8fqO+oHahuQJFw=; b=dkCaouDXZ44crNRHOwQe+67YJxkWcQeJgSInG0rIx3Ae4RgGnPzQkoYZhLPZH7q9JX gmGAC6zq2TRTTLeO8HAbUlWmZt0z69+LJGkXlKZ7+i3/UcucvGPz7V5mmYxjgcyHmib7 BUQr8o5yTkg9a+FMzI+Xk3ycTeq6qq/KzXAluKFvRPswoRwold30PqpqqRz9uxBYXLwQ RcpGg5/T3H5uE1kllg06QIdKLoK5JIpBOb0OAPO6WgSKtB/rEbAR8LvWoxVdjsA/nZC9 0hGDl5gPNI7xDv5EX81ST/E8Fp1mN6lX9IbqOxnwi0oLVq3+cM1ZxqSKcSxFTAplv+LS +JMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=LQL0DKsOtk+iizoMcZiglxI8x/B+r8fqO+oHahuQJFw=; b=fUNRJbjIQK/ERvq5xbJVeXzd80eA9Xxgo2iVEi7WeDQCmHNdTVAaCcYpZQTt/aHk70 sOEoII5HfYxmn3+kCLIcCPZssiVw+x+OXTzm/PETyFfMw5megG9abZdIsCA9PaXCVqWO 9d/CBygI7QMQmSu3fDLlS1EcgJDQZ0QfFNbz4OEPeL86wEr/3RJ6VZrXrS3R7e2wdB7K 4seQikOY7Shr8UcKqkjMHnA3wnG0pNxVA87wK3WadHYGjSCzgzZ6it5MjKwJ9ILag+Pe KYVfpYNzVBQ7IZTWb0u6KBCupgDq5UWUBFaw1DFzdNgperx8UBaAsCO2pl8Kp1acbj8A uTUQ== X-Gm-Message-State: AG10YOR4y7n8OQ2TZIJtfRlV3fgBNnL5nDIFDtAzC5w2nesJKgIHRS93LxBMffhgpM6uCAIJfVnRAaPGq9bXaw== MIME-Version: 1.0 X-Received: by 10.50.150.42 with SMTP id uf10mr7850287igb.23.1455080909755; Tue, 09 Feb 2016 21:08:29 -0800 (PST) Received: by 10.36.28.194 with HTTP; Tue, 9 Feb 2016 21:08:29 -0800 (PST) In-Reply-To: <1270b9585a3e327733049d87e8a08103@utsuho.znet> References: <1270b9585a3e327733049d87e8a08103@utsuho.znet> Date: Tue, 9 Feb 2016 21:08:29 -0800 Message-ID: Subject: Re: [9front] syslog(2) change From: "Devon H. O'Dell" To: 9front@9front.org Content-Type: text/plain; charset=UTF-8 List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: configuration proxy XML over JSON map/reduce-based out-scaling locator go for the gusto and implement 5424 2016-02-09 21:03 GMT-08:00 : > Currently, syslog() prints sysname, date/time, and fmt. > Check out the diff and tell me if I'm just being dumb. > > Sample before/after lines... > > cirno Feb 9 20:38:55 Hung up on 8.8.8.8; claimed to be fbi.gov > 1455068335 cirno Hung up on 8.8.8.8; claimed to be fbi.gov > > > Nobody wants this stupid crap where you have to try to recall which > timezone(s) a machine is/was in. Also, with this change it's easy to > plot out occurrences of some log string over time, as you don't have > to do any date string conversions (useful when trying to track down > bugs that don't present themselves frequently). > > The only con I can think of is that you'll need to use date(1) > to convert the timestamp if you want your date string, but hey, > at least the timestamp isn't ambiguous. > diff -r 94c649383b95 sys/man/2/perror > --- a/sys/man/2/perror Tue Feb 09 16:24:41 2016 -0500 > +++ b/sys/man/2/perror Tue Feb 09 19:54:00 2016 -0500 > @@ -36,8 +36,8 @@ > .I Logname > must contain no slashes. > The message is a line with several fields: > +seconds since the epoch; > the name of the machine writing the message; > -the date and time; > the message specified by the > .IR print (2) > format > diff -r 94c649383b95 sys/src/libc/9sys/syslog.c > --- a/sys/src/libc/9sys/syslog.c Tue Feb 09 16:24:41 2016 -0500 > +++ b/sys/src/libc/9sys/syslog.c Tue Feb 09 19:54:00 2016 -0500 > @@ -43,7 +43,7 @@ > syslog(int cons, char *logname, char *fmt, ...) > { > char buf[1024]; > - char *ctim, *p; > + char *p; > va_list arg; > int n; > Dir *d; > @@ -92,11 +92,7 @@ > return; > } > > - ctim = ctime(time(0)); > - p = buf + snprint(buf, sizeof(buf)-1, "%s ", sysname()); > - strncpy(p, ctim+4, 15); > - p += 15; > - *p++ = ' '; > + p = buf + snprint(buf, sizeof(buf)-1, "%ld %s ", time(0), sysname()); > errstr(err, sizeof err); > va_start(arg, fmt); > p = vseprint(p, buf+sizeof(buf)-1, fmt, arg);