Skip to content

Commit

Permalink
write two empty bytes after each protobuf access log
Browse files Browse the repository at this point in the history
  • Loading branch information
Keksoj committed Mar 11, 2024
1 parent 85e2653 commit 6daf43c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions command/src/logging/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,9 @@ impl InnerLogger {
}
}

/// write an access log to the proper logging target
///
/// Protobuf access logs are written with a prost length delimiter before, and 2 empty bytes after
pub fn log_access(&mut self, log: RequestRecord) {
let backend = self.access_backend.as_mut().unwrap_or(&mut self.backend);

Expand All @@ -239,6 +242,7 @@ impl InnerLogger {
if let Err(e) = binary_log.encode_length_delimited(&mut self.buffer.0) {
Err(IoError::new(IoErrorKind::InvalidData, e))
} else {
self.buffer.extend_from_slice(&[0, 0]); // add two empty bytes after each protobuf access log
let bytes = &self.buffer;
match backend {
LoggerBackend::Stdout(stdout) => {
Expand Down

0 comments on commit 6daf43c

Please sign in to comment.