mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
log: play back prior log entries when opening log.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
a3a5ba5f21
commit
c4ffec57b4
@ -502,6 +502,7 @@ static void setup_log_rotation(struct lightningd *ld)
|
||||
|
||||
char *arg_log_to_file(const char *arg, struct lightningd *ld)
|
||||
{
|
||||
const struct log_entry *i;
|
||||
FILE *logf;
|
||||
|
||||
if (ld->logfile) {
|
||||
@ -515,6 +516,12 @@ char *arg_log_to_file(const char *arg, struct lightningd *ld)
|
||||
if (!logf)
|
||||
return tal_fmt(NULL, "Failed to open: %s", strerror(errno));
|
||||
set_log_outfn(ld->log->lr, log_to_file, logf);
|
||||
|
||||
/* Catch up */
|
||||
list_for_each(&ld->log->lr->log, i, list)
|
||||
maybe_print(ld->log, i, 0);
|
||||
|
||||
log_debug(ld->log, "Opened log file %s", arg);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user