SkuldNorniern / fluere

Fluere is a powerful and versatile tool designed for network monitoring and analysis. It is capable of capturing network packets in pcap format and converting them into NetFlow data, providing a comprehensive view of network traffic. It also Provides Terminal User Interface.
Apache License 2.0
33 stars 3 forks source link

Modify log.rs to support logging in .log file #46

Closed sweep-ai[bot] closed 1 year ago

sweep-ai[bot] commented 1 year ago

Description

This PR modifies the log.rs file to support logging to a .log file instead of the syslog. It also implements proper log level handling and follows the conventional commit rule for the commit message title. The changes are made without using any external crate.

Summary

Please review and merge this PR. Thank you!

Fixes #31.


To checkout this PR branch, run the following command in your terminal:

git checkout {pull_request.branch_name}

🎉 Latest mprovements to Sweep:


💡 To get Sweep to edit this pull request, you can:

SkuldNorniern commented 1 year ago

can you implement the timestamp for the logger

sweep-ai[bot] commented 1 year ago

can you implement the timestamp for the logger

Hi @SkuldNorniern,

I decided to make the following changes:

File Path Proposed Changes
src/utils/log.rs Modify src/utils/log.rs with contents:
• Import the Local struct from the chrono crate.
• Modify the log() function to include the current timestamp in the log message.
• Get the current timestamp using Local::now().
• Format the timestamp using the format() function and append it to the log message.
• Write the updated log message to the log file.
SkuldNorniern commented 1 year ago

any update to the commit?

sweep-ai[bot] commented 1 year ago

any update to the commit?

Hi @SkuldNorniern,

I decided to make the following changes:

File Path Proposed Changes
src/utils/log.rs Modify src/utils/log.rs with contents:
• Update the commit message to address any issues or provide additional information.
sweep-ai[bot] commented 1 year ago

GitHub actions yielded the following error.

The command that failed is cargo install clippy-sarif sarif-fmt. Here are the relevant lines from the logs:

error[E0507]: cannot move out of `*self` which is behind a shared reference
--> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo_metadata-0.15.4/src/diagnostic.rs:95:24
|
95 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
|                        ^^^^^^^^^
|                        |
|                        data moved here
|                        move occurs because `unrecognized` has type `Applicability`, which does not implement the `Copy` trait
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider borrowing here
|
95 | #[derive(Debug, Clone, &Serialize, Deserialize, PartialEq, Eq, Hash)]
|                        +

error[E0507]: cannot move out of `*self` which is behind a shared reference
--> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo_metadata-0.15.4/src/messages.rs:104:24
|
104 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
|                        ^^^^^^^^^
|                        |
|                        data moved here
|                        move occurs because `unrecognized` has type `Message`, which does not implement the `Copy` trait
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider borrowing here
|
104 | #[derive(Debug, Clone, &Serialize, Deserialize, PartialEq, Eq, Hash)]
|                        +

For more information about this error, try `rustc --explain E0507`.
error: could not compile `cargo_metadata` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

This is likely a linting or type-checking issue with the source code. Update the code changed by the PR. Don't modify the existing tests.

sweep-ai[bot] commented 1 year ago

The command that failed is cargo install clippy-sarif sarif-fmt. Here are the relevant lines from the logs:

error[E0507]: cannot move out of `*self` which is behind a shared reference
--> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo_metadata-0.15.4/src/diagnostic.rs:95:24
|
95 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
|                        ^^^^^^^^^
|                        |
|                        data moved here
|                        move occurs because `unrecognized` has type `Applicability`, which does not implement the `Copy` trait
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider borrowing here
|
95 | #[derive(Debug, Clone, &Serialize, Deserialize, PartialEq, Eq, Hash)]
|                        +

error[E0507]: cannot move out of `*self` which is behind a shared reference
--> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo_metadata-0.15.4/src/messages.rs:104:24
|
104 | #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
|                        ^^^^^^^^^
|                        |
|                        data moved here
|                        move occurs because `unrecognized` has type `Message`, which does not implement the `Copy` trait
|
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider borrowing here
|
104 | #[derive(Debug, Clone, &Serialize, Deserialize, PartialEq, Eq, Hash)]
|                        +

For more information about this error, try `rustc --explain E0507`.
error: could not compile `cargo_metadata` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

There are a lot of errors. This is likely due to a small parsing issue or a missing import with the files changed in the PR.

Hi @sweep-ai[bot],

I decided to make the following changes:

File Path Proposed Changes
src/utils/log.rs Modify src/utils/log.rs with contents:
• Modify line 39: Change #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)] to #[derive(Debug, Clone, &Serialize, Deserialize, PartialEq, Eq, Hash)].
• Modify line 43: Change #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)] to #[derive(Debug, Clone, &Serialize, Deserialize, PartialEq, Eq, Hash)].