Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024/03/13/rust-24-actix-web-and-logging #4

Open
utterances-bot opened this issue Mar 14, 2024 · 2 comments
Open

2024/03/13/rust-24-actix-web-and-logging #4

utterances-bot opened this issue Mar 14, 2024 · 2 comments
Labels

Comments

@utterances-bot
Copy link

Rust: Actix-web and Daily Logging | behai-nguyen software development learnings and documentation

Currently, our actix-web learning application simply prints debug information to the console using the println! macro. In this post, we will implement proper non-blocking daily logging to files. Daily logging entails rotating to a new log file each day. Non-blocking refers to having a dedicated thread for file writing operations. We will utilise the tracing, tracing-appender, and tracing-subscriber crates for our logging implementation.

https://behai-nguyen.github.io/2024/03/13/rust-24-actix-web-and-logging.html

Copy link
Owner

behai-nguyen commented Mar 14, 2024

Note, the following also raises IndeterminateOffset error:

    let now_local = time::OffsetDateTime::now_local();
    let now_offset = now_local.unwrap();
    let timer = OffsetTime::new(
        now_offset.offset(),
        format_description!("[year]-[month]-[day]-[hour]:[minute]:[second]"),
    );

now_local is in error.

Copy link
Owner

In tests/common.rs, function spawn_app(), time::OffsetDateTime::now_local() also raises IndeterminateOffset error:

    let offset = time::OffsetDateTime::now_local().unwrap().offset()
        .as_hms();
    // let guard = init_app_logger(UtcOffset::from_hms(11, 0, 0).unwrap());
    let guard = init_app_logger(UtcOffset::from_hms(offset.0, offset.1, offset.2).unwrap());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants