* Patch: print date including year in syslog messages
@ 2018-11-14 15:31 stevie
2018-11-14 20:17 ` [9front] " BurnZeZ
0 siblings, 1 reply; 2+ messages in thread
From: stevie @ 2018-11-14 15:31 UTC (permalink / raw)
To: 9front
Hello,
here's a small patch to print the full date including year in syslog messages:
term% diff syslog.c /sys/src/libc/9sys/syslog.c
97,98c97,98
< strncpy(p, ctim+4, 24);
< p += 24;
---
> strncpy(p, ctim+4, 15);
> p += 15;
Hope that's useful.
stevie
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [9front] Patch: print date including year in syslog messages
2018-11-14 15:31 Patch: print date including year in syslog messages stevie
@ 2018-11-14 20:17 ` BurnZeZ
0 siblings, 0 replies; 2+ messages in thread
From: BurnZeZ @ 2018-11-14 20:17 UTC (permalink / raw)
To: 9front
[-- Attachment #1: Type: text/plain, Size: 180 bytes --]
On Wed Nov 14 20:08:58 GMT 2018, stevie@kamalatta.ddnss.de wrote:
> Hello,
>
> here's a small patch to print the full date including year in syslog messages:
Here’s what I use.
[-- Attachment #2: Type: text/plain, Size: 666 bytes --]
diff -r 4136602b93e9 sys/src/libc/9sys/syslog.c
--- a/sys/src/libc/9sys/syslog.c Wed Nov 14 11:33:52 2018 -0800
+++ b/sys/src/libc/9sys/syslog.c Wed Nov 14 20:16:01 2018 +0000
@@ -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, "%s %ld ", sysname(), time(0));
errstr(err, sizeof err);
va_start(arg, fmt);
p = vseprint(p, buf+sizeof(buf)-1, fmt, arg);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-14 20:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14 15:31 Patch: print date including year in syslog messages stevie
2018-11-14 20:17 ` [9front] " BurnZeZ
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).