Commit Graph

30 Commits

Author SHA1 Message Date
Rusty Russell 9327aa1df4 lightningd: fix logging of peer death.
We used level -1 to mean "append to log", but that doesn't actually
work, and results in an assert if we try to prune the logs:

	lightningd: daemon/pseudorand.c:36: pseudorand: Assertion `max' failed.

Expose logv_add and use that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-06-23 09:29:42 +09:30
Rusty Russell 61a2ed97e1 lightningd/peer_control: start of reconnect logic.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-05-25 14:24:47 +09:30
Rusty Russell c8df820e58 lightning/peer_control: set logging level for peers to match global.
That way it's controlled by --log-level=

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-02-24 16:22:56 +10:30
Christian Decker 091c2fc8f5 log: Flushing logs on each new entry
This is to speed up the python testing framework and should not have a
big impact on performance.
2017-01-23 10:37:34 +01:00
Christian Decker 3f79a0e117 log: Flushing logs on every line
This is needed for the new testing framework since we wait for
messages to be printed on stdout. Buffering delays this
arbitrarily. Flushing so often should not have much of a performance
impact.
2017-01-23 10:45:36 +10:30
Rusty Russell 4a233090ae log: rename struct log_record to struct log_book.
I think "log entry" when I see "log record", so this name is better.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:18:26 +10:30
Rusty Russell 350d8edb7e log: don't include dstate any more.
Before we had a global secp256k1_ctx we needed to hold this to print
out pubkeys, now it's completely orthogonal.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-10 15:17:51 +10:30
Rusty Russell f8eb454139 type_to_string: move pretty printing of types from log
It's not just useful for logging.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2017-01-04 14:05:15 +10:30
Lucas Betschart 900ab78d46 Fix -Wtautological-constant-out-of-range-compare 2016-12-14 08:47:21 +01:00
Rusty Russell a4fdaab5b3 Use global secp256k1_ctx instead of passing it around.
If I'd known how large this patch would be (though trivial), I'd
have done it in parts.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-12-02 18:12:58 +10:30
Rusty Russell 4bed6c8c67 controlled_time: remove
We don't need it for testing at the moment, and if we do it'll have
to change to relative anyway now we're going to use time_mono().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-09 18:54:15 +10:30
Rusty Russell 8015ceadfd log: add netaddr
Also avoids allocating netaddr_name which otherwise lasts as long
as connection does.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-04 11:17:03 +10:30
Rusty Russell a4ee683b3e tal_tmpctx: clear marker for temporary contexts.
This makes them stand out in memory dumps.  Also plug two existing
memory leaks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-11-01 21:34:27 +10:30
Rusty Russell 68632e6020 Use "msatoshi" not "msatoshis" everywhere.
Including in JSON API.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-09-06 16:47:49 +09:30
Rusty Russell d8af789bbb channel: remove enum channel_side, rename htlc_side to side.
We had enum channel_side (OURS, THEIRS) for which end of a channel we
had, and htlc_side (LOCAL, REMOTE) for who proposed the HTLC.

Combine these both into simply "enum side".

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-31 16:06:32 +09:30
Rusty Russell 1518f4424e log: add channel_state logging ability.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-31 16:06:32 +09:30
Rusty Russell bb0bf2b5ad log: add easy way to log hex blobs.
Use it in one case, and also fix another logging FIXME.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-31 16:06:32 +09:30
Rusty Russell d0285416fb log: ability to log struct rval.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-08-17 14:46:42 +09:30
Rusty Russell a613d8d1fb peer: make id a pointer, NULL until we know peer's ID.
Much better than undefined, and testing for NULL is better than
testing for STATE_INIT.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-07-01 12:00:17 +09:30
Rusty Russell 42bed80145 pubkey: don't carry around DER encoding.
We just wrap the libsecp256k1 structure, and convert to DER on demand.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-07-01 12:00:17 +09:30
Rusty Russell a35055c699 log: keep dstate pointer.
We need its secpctx pointer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-07-01 12:00:17 +09:30
Rusty Russell 45cac95331 log: logging for HTLCs.
The most complex thing we've logged yet, so we extract the core of the
log_struct_ function to call it multiple times.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-07-01 12:00:17 +09:30
Rusty Russell 5296b7f9a0 log: add structure logging.
Uses a gcc extension (cast to union) for typechecking, but that can be
removed for compilers which don't support it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-07-01 12:00:17 +09:30
Rusty Russell 1d27428aab log: use real time for logs, even if dev-mocktime is used.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-24 19:35:13 +09:30
Rusty Russell a3e3f83d9f daemon: dev-mocktime command
Useful for precise timing control for testing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:45:28 +10:30
Rusty Russell 29c8611e53 daemon: add helper to log hex.
Good for keys; eventually we'll want to log structures by type though.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:48 +10:30
Rusty Russell 7b766f4bc8 daemon: fatal() function.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:48 +10:30
Rusty Russell 89f1f1548e daemon: dump logs on crash.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:47 +10:30
Rusty Russell 117cf6b02d daemon: add logging options.
Particularly logging to file.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:47 +10:30
Rusty Russell dd35260ce8 daemon: first code.
Logging code based heavily on pettycoin's.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-01-22 06:41:47 +10:30