Skip to content

Commit

Permalink
fix log is not work
Browse files Browse the repository at this point in the history
  • Loading branch information
fankaiLiu committed Dec 16, 2023
1 parent 4e282e5 commit 0f3c866
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
23 changes: 10 additions & 13 deletions src/template/src/main_template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,16 @@ mod routers;
#[tokio::main]
async fn main() {
//{{main_log_message}}
init_log();
let _guard = clia_tracing_config::build()
.filter_level(&CFG.log.filter_level)
.with_ansi(CFG.log.with_ansi)
.to_stdout(CFG.log.to_stdout)
.directory(&CFG.log.directory)
.file_name(&CFG.log.file_name)
.rolling(&CFG.log.rolling)
.init();
tracing::info!("log level: {}", &CFG.log.filter_level);

{{#if is_sea_orm_or_sqlx}}
init_db_conn().await;
{{/if}}
Expand Down Expand Up @@ -108,18 +117,6 @@ async fn main() {
}
}

fn init_log() {
let _guard = clia_tracing_config::build()
.filter_level(&CFG.log.filter_level)
.with_ansi(CFG.log.with_ansi)
.to_stdout(CFG.log.to_stdout)
.directory(&CFG.log.directory)
.file_name(&CFG.log.file_name)
.rolling(&CFG.log.rolling)
.init();
tracing::info!("log level: {}", &CFG.log.filter_level);
}

async fn shutdown_signal(handle: ServerHandle) {
let ctrl_c = async {
signal::ctrl_c()
Expand Down
1 change: 1 addition & 0 deletions src/utils/check_for_updates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ async fn get_latest_version(crate_name: &str) -> Result<String, Box<dyn std::err
let client = reqwest::Client::builder()
.user_agent("salvo-cli update checker")
.build()?;

let resp = client.get(&url).send().await?;
let body: String = resp.text().await?;
let crate_response: Value = serde_json::from_str(&body)?;
Expand Down

0 comments on commit 0f3c866

Please sign in to comment.