2 stable releases

1.0.1 Nov 7, 2022

#194 in #grpc

MIT license

55KB
556 lines

CodeCTRL Rust Logger

The Rust-based logger for integration with CodeCTRL.

What is the purpose of this?

The purpose of this logger and CodeCTRL in general is to be able to better understand the control-flow, data and to find potential UB in Rust-based projects.

We at Authentura have and will use CodeCTRL and its language loggers to help us perform our code analysis service: Rust included.

How does it work?

This logger (and the rest of the official-loggers) connect to a CodeCTRL-compatible gRPC server and send a user-created log at a specified point in the code. A CodeCTRL front-end can then connect to those very same gRPC servers and receive a copy of the sent logs to that server.

This Rust implementation connects to the gRPC server using a crate called tonic, which is a handy crate to generate common interfaces to a gRPC server and connect to said gRPC servers.

Example

Here's a quick example of how to use this crate:

use codectrl::{Logger, LoggerError};
use tokio::runtime::Handle;

fn main() -> anyhow::Result<()> {
  fn inner() -> Result<(), LoggerError> {
    Logger::log("Hello, world!", None, None, None, None)
  }

  inner()?;

  Ok(())
}

Which will produce the following output in the details panel of CodeCTRL:

example.png

Dependencies

~8–22MB
~268K SLoC