Skip to content

Commit 9f5ca3d

Browse files
committed
Enable SSE logs only on GUI flag and misc reviewers comments
1 parent 5eeca70 commit 9f5ca3d

File tree

7 files changed

+14
-15
lines changed

7 files changed

+14
-15
lines changed

beacon_node/http_api/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3750,7 +3750,7 @@ pub fn serve<T: BeaconChainTypes>(
37503750
}
37513751
}
37523752
Err(e) => Err(warp_utils::reject::server_sent_event_error(
3753-
format!("Unable to serialize to JSON {}", e),
3753+
format!("Unable to receive event {}", e),
37543754
)),
37553755
}
37563756
});
@@ -3929,4 +3929,4 @@ fn publish_network_message<T: EthSpec>(
39293929
e
39303930
))
39313931
})
3932-
}
3932+
}

beacon_node/src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
10811081
.long("gui")
10821082
.hidden(true)
10831083
.help("Enable the graphical user interface and all its requirements. \
1084-
This is equivalent to --http and --validator-monitor-auto.")
1084+
This enables --http and --validator-monitor-auto and enables SSE logging.")
10851085
.takes_value(false)
10861086
)
10871087
.arg(
@@ -1093,4 +1093,4 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
10931093
// always using the builder.
10941094
.conflicts_with("builder-profit-threshold")
10951095
)
1096-
}
1096+
}

book/src/api-lighthouse.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ Caveats:
684684

685685
This is a Server Side Event subscription endpoint. This allows a user to read
686686
the Lighthouse logs directly from the HTTP API endpoint. This currently
687-
exposes INFO and higher level logs.
687+
exposes INFO and higher level logs. It is only enabled when the `--gui` flag is set in the CLI.
688688

689689
Example:
690690

@@ -694,7 +694,7 @@ curl -N "http://localhost:5052/lighthouse/logs"
694694

695695
Should provide an output that emits log events as they occur:
696696
```json
697-
{
697+
{
698698
"data": {
699699
"time": "Mar 13 15:28:41",
700700
"level": "INFO",
@@ -707,4 +707,3 @@ Should provide an output that emits log events as they occur:
707707
}
708708
}
709709
```
710-

book/src/api-vc-endpoints.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -588,9 +588,9 @@ logs emitted are INFO level or higher.
588588

589589
| Property | Specification |
590590
|-------------------|--------------------------------------------|
591-
| Path | `/lighthouse/logs` |
591+
| Path | `/lighthouse/logs` |
592592
| Method | GET |
593-
| Required Headers | [`Authorization`](./api-vc-auth-header.md) |
593+
| Required Headers | None |
594594
| Typical Responses | 200 |
595595

596596
### Example Response Body
@@ -607,4 +607,4 @@ logs emitted are INFO level or higher.
607607
"total": 1
608608
}
609609
}
610-
```
610+
```

common/logging/src/sse_logging_components.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ impl Drain for SSELoggingComponents {
3535

3636
fn log(&self, record: &Record, logger_values: &OwnedKVList) -> Result<Self::Ok, Self::Err> {
3737
if record.level().is_at_least(LOG_LEVEL) {
38-
// There are subscribers, attempt to send the logs
38+
// Attempt to send the logs
3939
match self.sender.send(AsyncRecord::from(record, logger_values)) {
4040
Ok(_num_sent) => {} // Everything got sent
4141
Err(_err) => {} // There are no subscribers, do nothing
4242
}
4343
}
4444
Ok(())
4545
}
46-
}
46+
}

lighthouse/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ fn run<E: EthSpec>(
485485

486486
let sse_logging = {
487487
if let Some(bn_matches) = matches.subcommand_matches("beacon_node") {
488-
bn_matches.is_present("http") || bn_matches.is_present("gui")
488+
bn_matches.is_present("gui")
489489
} else if let Some(vc_matches) = matches.subcommand_matches("validator_client") {
490490
vc_matches.is_present("http")
491491
} else {

validator_client/src/http_api/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ pub fn serve<T: 'static + SlotClock + Clone, E: EthSpec>(
10581058
}
10591059
}
10601060
Err(e) => Err(warp_utils::reject::server_sent_event_error(
1061-
format!("Unable to serialize to JSON {}", e),
1061+
format!("Unable to receive event {}", e),
10621062
)),
10631063
}
10641064
});
@@ -1174,4 +1174,4 @@ where
11741174

11751175
response
11761176
})
1177-
}
1177+
}

0 commit comments

Comments
 (0)