9front - general discussion about 9front
 help / color / mirror / Atom feed
From: BurnZeZ@feline.systems
To: 9front@9front.org
Subject: Re: [9front] Patch: print date including year in syslog messages
Date: Wed, 14 Nov 2018 20:17:07 +0000	[thread overview]
Message-ID: <4ed5dd2851743addc49bbaf2550d5d02@rebk.znet> (raw)
In-Reply-To: <7615E341164956BA0275FB967B22F086@kamalatta.ddnss.de>

[-- 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);

      reply	other threads:[~2018-11-14 20:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14 15:31 stevie
2018-11-14 20:17 ` BurnZeZ [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ed5dd2851743addc49bbaf2550d5d02@rebk.znet \
    --to=burnzez@feline.systems \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).