Skip to content

Commit c074fe0

Browse files
committed
lightningd/log: clean up nomenclature.
`struct log` becomes `struct logger`, and the member which points to the `struct log_book` becomes `->log_book` not `->lr`. Also, we don't need to keep the log_book in struct plugin, since it has access to ld's log_book. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 19d80e1 commit c074fe0

37 files changed

+254
-256
lines changed

common/json_stream.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static void adjust_io_write(struct json_out *jout,
3838

3939
struct json_stream *new_json_stream(const tal_t *ctx,
4040
struct command *writer,
41-
struct log *log)
41+
struct logger *log)
4242
{
4343
struct json_stream *js = tal(ctx, struct json_stream);
4444

@@ -73,7 +73,7 @@ const char *json_stream_detach_filter(const tal_t *ctx, struct json_stream *js)
7373

7474
struct json_stream *json_stream_dup(const tal_t *ctx,
7575
struct json_stream *original,
76-
struct log *log)
76+
struct logger *log)
7777
{
7878
struct json_stream *js = tal_dup(ctx, struct json_stream, original);
7979

common/json_stream.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
struct command;
1919
struct io_conn;
20-
struct log;
20+
struct logger;
2121
struct json_escape;
2222
struct pubkey;
2323
struct bip340sig;
@@ -53,7 +53,7 @@ struct json_stream {
5353
struct json_filter *filter;
5454

5555
/* Where to log I/O */
56-
struct log *log;
56+
struct logger *log;
5757
};
5858

5959

@@ -64,7 +64,7 @@ struct json_stream {
6464
* @log: where to log the IO
6565
*/
6666
struct json_stream *new_json_stream(const tal_t *ctx, struct command *writer,
67-
struct log *log);
67+
struct logger *log);
6868

6969
/**
7070
* Duplicate an existing stream.
@@ -80,7 +80,7 @@ struct json_stream *new_json_stream(const tal_t *ctx, struct command *writer,
8080
*/
8181
struct json_stream *json_stream_dup(const tal_t *ctx,
8282
struct json_stream *original,
83-
struct log *log);
83+
struct logger *log);
8484

8585
/* Attach a filter. Usually this works at the result level: you don't
8686
* want to filter out id, etc! */

common/test/run-json_filter.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ int segwit_addr_decode(
127127
const char* addr
128128
)
129129
{ fprintf(stderr, "segwit_addr_decode called!\n"); abort(); }
130+
/* Generated stub for to_canonical_invstr */
131+
const char *to_canonical_invstr(const tal_t *ctx UNNEEDED, const char *invstring UNNEEDED)
132+
{ fprintf(stderr, "to_canonical_invstr called!\n"); abort(); }
130133
/* Generated stub for towire */
131134
void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED)
132135
{ fprintf(stderr, "towire called!\n"); abort(); }
@@ -152,9 +155,6 @@ void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED)
152155
/* Generated stub for towire_u8_array */
153156
void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED)
154157
{ fprintf(stderr, "towire_u8_array called!\n"); abort(); }
155-
/* Generated stub for strip_lightning_prefix */
156-
const char *to_canonical_invstr(const tal_t *ctx, const char *invstring UNNEEDED)
157-
{ fprintf(stderr, "strip_lightning_prefix called!\n"); abort(); }
158158
/* AUTOGENERATED MOCKS END */
159159

160160
bool deprecated_apis;

common/test/run-json_remove.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ int segwit_addr_decode(
162162
const char* addr
163163
)
164164
{ fprintf(stderr, "segwit_addr_decode called!\n"); abort(); }
165+
/* Generated stub for to_canonical_invstr */
166+
const char *to_canonical_invstr(const tal_t *ctx UNNEEDED, const char *invstring UNNEEDED)
167+
{ fprintf(stderr, "to_canonical_invstr called!\n"); abort(); }
165168
/* Generated stub for towire */
166169
void towire(u8 **pptr UNNEEDED, const void *data UNNEEDED, size_t len UNNEEDED)
167170
{ fprintf(stderr, "towire called!\n"); abort(); }
@@ -187,9 +190,6 @@ void towire_u8(u8 **pptr UNNEEDED, u8 v UNNEEDED)
187190
/* Generated stub for towire_u8_array */
188191
void towire_u8_array(u8 **pptr UNNEEDED, const u8 *arr UNNEEDED, size_t num UNNEEDED)
189192
{ fprintf(stderr, "towire_u8_array called!\n"); abort(); }
190-
/* Generated stub for strip_lightning_prefix */
191-
const char *to_canonical_invstr(const tal_t *ctx, const char *invstring UNNEEDED)
192-
{ fprintf(stderr, "strip_lightning_prefix called!\n"); abort(); }
193193
/* AUTOGENERATED MOCKS END */
194194

195195
struct json {

common/test/run-param.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ struct command_result *command_fail(struct command *cmd,
4040
/* Generated stub for command_filter_ptr */
4141
struct json_filter **command_filter_ptr(struct command *cmd UNNEEDED)
4242
{ fprintf(stderr, "command_filter_ptr called!\n"); abort(); }
43-
/* Generated stub for strip_lightning_prefix */
44-
const char *to_canonical_invstr(const tal_t *ctx, const char *invstring UNNEEDED)
45-
{ fprintf(stderr, "strip_lightning_prefix called!\n"); abort(); }
4643
/* Generated stub for fromwire_tlv */
4744
bool fromwire_tlv(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
4845
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,
4946
void *record UNNEEDED, struct tlv_field **fields UNNEEDED,
5047
const u64 *extra_types UNNEEDED, size_t *err_off UNNEEDED, u64 *err_type UNNEEDED)
5148
{ fprintf(stderr, "fromwire_tlv called!\n"); abort(); }
49+
/* Generated stub for to_canonical_invstr */
50+
const char *to_canonical_invstr(const tal_t *ctx UNNEEDED, const char *invstring UNNEEDED)
51+
{ fprintf(stderr, "to_canonical_invstr called!\n"); abort(); }
5252
/* Generated stub for towire_tlv */
5353
void towire_tlv(u8 **pptr UNNEEDED,
5454
const struct tlv_record_type *types UNNEEDED, size_t num_types UNNEEDED,

lightningd/bitcoind.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ static void destroy_bitcoind(struct bitcoind *bitcoind)
853853

854854
struct bitcoind *new_bitcoind(const tal_t *ctx,
855855
struct lightningd *ld,
856-
struct log *log)
856+
struct logger *log)
857857
{
858858
struct bitcoind *bitcoind = tal(ctx, struct bitcoind);
859859

lightningd/bitcoind.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct bitcoin_block;
1717

1818
struct bitcoind {
1919
/* Where to do logging. */
20-
struct log *log;
20+
struct logger *log;
2121

2222
/* Main lightningd structure */
2323
struct lightningd *ld;
@@ -56,7 +56,7 @@ struct filteredblock {
5656

5757
struct bitcoind *new_bitcoind(const tal_t *ctx,
5858
struct lightningd *ld,
59-
struct log *log);
59+
struct logger *log);
6060

6161
void bitcoind_estimate_fees(struct bitcoind *bitcoind,
6262
void (*cb)(struct lightningd *ld,

lightningd/chaintopology.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ static void destroy_chain_topology(struct chain_topology *topo)
12291229
}
12301230
}
12311231

1232-
struct chain_topology *new_topology(struct lightningd *ld, struct log *log)
1232+
struct chain_topology *new_topology(struct lightningd *ld, struct logger *log)
12331233
{
12341234
struct chain_topology *topo = tal(ld, struct chain_topology);
12351235

lightningd/chaintopology.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ struct chain_topology {
117117
struct feerate_est *smoothed_feerates;
118118

119119
/* Where to log things. */
120-
struct log *log;
120+
struct logger *log;
121121

122122
/* What range of blocks do we have in our database? */
123123
u32 min_blockheight, max_blockheight;
@@ -243,7 +243,7 @@ void broadcast_tx_(struct chain_topology *topo,
243243
bool (*refresh)(struct channel *, const struct bitcoin_tx **, void *),
244244
void *cbarg TAKES);
245245

246-
struct chain_topology *new_topology(struct lightningd *ld, struct log *log);
246+
struct chain_topology *new_topology(struct lightningd *ld, struct logger *log);
247247
void setup_topology(struct chain_topology *topology,
248248
u32 min_blockheight, u32 max_blockheight);
249249

lightningd/channel.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,10 @@ struct channel *new_unsaved_channel(struct peer *peer,
211211
memset(&channel->billboard, 0, sizeof(channel->billboard));
212212
channel->billboard.transient = tal_fmt(channel, "%s",
213213
"Empty channel init'd");
214-
channel->log = new_log(channel, ld->log_book,
215-
&peer->id,
216-
"chan#%"PRIu64,
217-
channel->unsaved_dbid);
214+
channel->log = new_logger(channel, ld->log_book,
215+
&peer->id,
216+
"chan#%"PRIu64,
217+
channel->unsaved_dbid);
218218

219219
channel->our_config.id = 0;
220220
channel->open_attempt = NULL;
@@ -334,7 +334,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
334334
enum channel_state state,
335335
enum side opener,
336336
/* NULL or stolen */
337-
struct log *log,
337+
struct logger *log,
338338
const char *transient_billboard TAKES,
339339
u8 channel_flags,
340340
bool req_confirmed_ins_local,
@@ -436,11 +436,11 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
436436
channel->scb = NULL;
437437

438438
if (!log) {
439-
channel->log = new_log(channel,
440-
peer->ld->log_book,
441-
&channel->peer->id,
442-
"chan#%"PRIu64,
443-
dbid);
439+
channel->log = new_logger(channel,
440+
peer->ld->log_book,
441+
&channel->peer->id,
442+
"chan#%"PRIu64,
443+
dbid);
444444
} else
445445
channel->log = tal_steal(channel, log);
446446
channel->req_confirmed_ins[LOCAL] = req_confirmed_ins_local;

0 commit comments

Comments
 (0)