Skip to content

Commit cf75311

Browse files
authored
Add logging (#236)
1 parent a798a36 commit cf75311

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

Cargo.lock

Lines changed: 64 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ bytes = "1.10.1"
1414
clap = { version = "^4.5.45", features = ["derive", "wrap_help"] }
1515
console = "^0.16.0"
1616
dialoguer = "^0.12.0"
17+
env_logger = "0.11.8"
1718
futures = "^0.3.31"
1819
futures-lite = "^2.6.1"
1920
git2 = { version = "^0.20.2", default-features = false }
@@ -23,6 +24,7 @@ http = "1.3.1"
2324
http-body = "1.0.1"
2425
indoc = "^2.0.6"
2526
lazy-regex = "^3.4.1"
27+
log = "0.4.27"
2628
octocrab = { version = "^0.44.1", default-features = false, features = ["opentls", "default-client", "tokio"] }
2729
open = "5.3.2"
2830
secrecy = { version = "0.10.3", default-features = false }

src/main.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//! stacked to allow for a series of code reviews of interdependent code.
1111
1212
use clap::{Parser, Subcommand};
13+
use log::debug;
1314
use spr::{
1415
commands,
1516
error::{Error, Result},
@@ -91,6 +92,7 @@ pub enum OptionsError {
9192

9293
pub async fn spr() -> Result<()> {
9394
let cli = Cli::parse();
95+
debug!("Started with command line: {:?}", cli);
9496

9597
if let Some(path) = &cli.cd {
9698
if let Err(err) = std::env::set_current_dir(path) {
@@ -157,6 +159,7 @@ pub async fn spr() -> Result<()> {
157159
require_approval,
158160
require_test_plan,
159161
);
162+
debug!("config: {:?}", config);
160163

161164
let git = spr::git::Git::new(repo);
162165

@@ -204,6 +207,8 @@ pub async fn spr() -> Result<()> {
204207

205208
#[tokio::main(flavor = "current_thread")]
206209
async fn main() -> Result<()> {
210+
env_logger::init();
211+
207212
if let Err(error) = tokio::task::LocalSet::new().run_until(spr()).await {
208213
for message in error.messages() {
209214
output("🛑", message)?;

0 commit comments

Comments
 (0)