From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ar.aichi-u.ac.jp ([202.250.160.40]) by ur; Wed Feb 10 00:41:41 EST 2016 Received: from [192.168.0.249] ([115.36.94.245]) by ar; Wed Feb 10 14:41:29 JST 2016 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: [9front] syslog(2) change From: arisawa In-Reply-To: <1270b9585a3e327733049d87e8a08103@utsuho.znet> Date: Wed, 10 Feb 2016 14:41:29 +0900 Content-Transfer-Encoding: quoted-printable Message-Id: References: <1270b9585a3e327733049d87e8a08103@utsuho.znet> To: 9front@9front.org X-Mailer: Apple Mail (2.2104) List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: GPU just-in-time rich-client controller Hi, I also hate current date/time format of /sys/log. that makes log analysis very difficult. I prefer cirno 2016-02-01 20:38:55 Hung up on 8.8.8.8; claimed to be fbi.gov instead of cirno Feb 9 20:38:55 Hung up on 8.8.8.8; claimed to be fbi.gov your 1455068335 cirno Hung up on 8.8.8.8; claimed to be fbi.gov is too radical, I think. I also prefer "2016-02-01 20:38:55=E2=80=9D style for ls -l to compare = with /sys/log. > 2016/02/10 14:03=E3=80=81BurnZeZ@feline.systems =E3=81=AE=E3=83=A1=E3=83= =BC=E3=83=AB=EF=BC=9A >=20 > Currently, syslog() prints sysname, date/time, and fmt. > Check out the diff and tell me if I'm just being dumb. >=20 > Sample before/after lines... >=20 > 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 >=20 >=20 > 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). >=20 > 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; > } >=20 > - ctim =3D ctime(time(0)); > - p =3D buf + snprint(buf, sizeof(buf)-1, "%s ", sysname()); > - strncpy(p, ctim+4, 15); > - p +=3D 15; > - *p++ =3D ' '; > + p =3D buf + snprint(buf, sizeof(buf)-1, "%ld %s ", time(0), = sysname()); > errstr(err, sizeof err); > va_start(arg, fmt); > p =3D vseprint(p, buf+sizeof(buf)-1, fmt, arg);