mirror of
https://github.com/hexedtech/codemp-nvim.git
synced 2024-11-22 23:44:55 +01:00
feat: allow to request remote tracing via socket
This commit is contained in:
parent
a872c39d7f
commit
77eae35bc3
1 changed files with 13 additions and 10 deletions
|
@ -212,6 +212,10 @@ struct CliArgs {
|
||||||
/// show debug level logs
|
/// show debug level logs
|
||||||
#[arg(long, default_value_t = false)]
|
#[arg(long, default_value_t = false)]
|
||||||
debug: bool,
|
debug: bool,
|
||||||
|
|
||||||
|
/// dump raw tracing logs into this TCP host
|
||||||
|
#[arg(long)]
|
||||||
|
remote_debug: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -219,22 +223,21 @@ struct CliArgs {
|
||||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let args = CliArgs::parse();
|
let args = CliArgs::parse();
|
||||||
|
|
||||||
let sub = tracing_subscriber::fmt();
|
match args.remote_debug {
|
||||||
match TcpStream::connect("127.0.0.1:6969") { // TODO get rid of this
|
Some(host) =>
|
||||||
Ok(stream) => {
|
tracing_subscriber::fmt()
|
||||||
sub.with_writer(Mutex::new(stream))
|
.with_writer(Mutex::new(TcpStream::connect(host)?))
|
||||||
.with_max_level(if args.debug { tracing::Level::DEBUG } else { tracing::Level::INFO })
|
.with_max_level(if args.debug { tracing::Level::DEBUG } else { tracing::Level::INFO })
|
||||||
.init();
|
.init(),
|
||||||
},
|
|
||||||
Err(_) => {
|
None =>
|
||||||
sub
|
tracing_subscriber::fmt()
|
||||||
.compact()
|
.compact()
|
||||||
.without_time()
|
.without_time()
|
||||||
.with_ansi(false)
|
.with_ansi(false)
|
||||||
.with_writer(std::io::stderr)
|
.with_writer(std::io::stderr)
|
||||||
.with_max_level(if args.debug { tracing::Level::DEBUG } else { tracing::Level::INFO })
|
.with_max_level(if args.debug { tracing::Level::DEBUG } else { tracing::Level::INFO })
|
||||||
.init();
|
.init(),
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let client = BufferClient::connect(args.host).await?;
|
let client = BufferClient::connect(args.host).await?;
|
||||||
|
|
Loading…
Reference in a new issue