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>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <time.h>
#include <unistd.h>
#include "ply-utils.h"
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);
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;
}