mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 10:08:06 +02:00
logger: Add a separator between different boot logs
Since we concatenate boot logs one after the other in /var/log/boot.log it is hard to tell where the logs from one boot end the next boot starts. This commit makes plymouth write out a separator including a time + date of the date, when the log file gets opened to add new boot messages to it. Note ply_logger_open_file() is only called from ply_terminal_session_open_log() which in turn is only used for /var/log/boot.log, so this only effects /var/log/boot.log. Closes #29 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
118c5ca1bc
commit
4de54f598b
1 changed files with 13 additions and 0 deletions
|
|
@ -34,6 +34,7 @@
|
|||
#include <sys/file.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ply-utils.h"
|
||||
|
|
@ -312,6 +313,9 @@ bool
|
|||
ply_logger_open_file (ply_logger_t *logger,
|
||||
const char *filename)
|
||||
{
|
||||
char header[80];
|
||||
struct tm* tm;
|
||||
time_t t;
|
||||
int fd;
|
||||
|
||||
assert (logger != NULL);
|
||||
|
|
@ -328,6 +332,15 @@ ply_logger_open_file (ply_logger_t *logger,
|
|||
|
||||
logger->filename = strdup (filename);
|
||||
|
||||
time (&t);
|
||||
tm = localtime (&t);
|
||||
if (tm) {
|
||||
/* This uses uname -v date format */
|
||||
strftime (header, sizeof(header),
|
||||
"------------ %a %b %d %T %Z %Y ------------\n", tm);
|
||||
ply_logger_write (logger, header, strlen(header), true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue