Skip to content

Commit

Permalink
Fallen
Browse files Browse the repository at this point in the history
  • Loading branch information
qarmin committed Oct 10, 2023
1 parent f77745f commit 42b4a9b
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
12 changes: 10 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@ assignees: ''
---

**Desktop (please complete the following information):**
- Czkawka version [e.g. 6.0.0 cli/gui]:
- OS version [e.g Ubuntu 22.04, Windows 11]:

- Czkawka version<!-- e.g. 6.0.0 cli/gui -->:
- OS version<!-- e.g Ubuntu 22.04, Windows 11, Mac 15.1 ARM -->:
- Terminal output[optional]:

<!--
Add terminal output only if needed - if there are some errors or warnings or you have performance/freeze issues.
Very helpful in this situation will be logs from czkawka run with RUST_LOG environment variable set e.g.
`RUST_LOG=debug ./czkawka` which will print more detailed info about executed function
-->

**Bug Description**
...
3 changes: 2 additions & 1 deletion czkawka_cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use commands::Commands;
use czkawka_core::bad_extensions::BadExtensions;
use czkawka_core::big_file::{BigFile, SearchMode};
use czkawka_core::broken_files::BrokenFiles;
use czkawka_core::common::{set_number_of_threads, setup_logger};
use czkawka_core::common::{print_version_mode, set_number_of_threads, setup_logger};
use czkawka_core::common_tool::{CommonData, DeleteMethod};
#[allow(unused_imports)] // It is used in release for print_results_to_output().
use czkawka_core::common_traits::*;
Expand All @@ -31,6 +31,7 @@ fn main() {
let command = Args::parse().command;

setup_logger(true);
print_version_mode();

if cfg!(debug_assertions) {
println!("{command:?}");
Expand Down
11 changes: 10 additions & 1 deletion czkawka_core/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ use image::{DynamicImage, ImageBuffer, Rgb};
use imagepipe::{ImageSource, Pipeline};
#[cfg(feature = "heif")]
use libheif_rs::{ColorSpace, HeifContext, RgbChroma};
use log::{LevelFilter, Record};
use log::{info, LevelFilter, Record};

// #[cfg(feature = "heif")]
// use libheif_rs::LibHeif;
use crate::common_dir_traversal::{CheckingMethod, ProgressData, ToolType};
use crate::common_directory::Directories;
use crate::common_items::ExcludedItems;
use crate::common_traits::ResultEntry;
use crate::CZKAWKA_VERSION;

static NUMBER_OF_THREADS: state::InitCell<usize> = state::InitCell::new();

Expand Down Expand Up @@ -53,6 +54,14 @@ pub fn setup_logger(disabled_printing: bool) {
handsome_logger::TermLogger::init(config, TerminalMode::Mixed, ColorChoice::Always).unwrap();
}

pub fn print_version_mode() {
info!(
"Czkawka version: {}, was compiled with {} mode",
CZKAWKA_VERSION,
if cfg!(debug_assertions) { "debug" } else { "release" }
);
}

pub fn set_default_number_of_threads() {
set_number_of_threads(num_cpus::get());
}
Expand Down
6 changes: 4 additions & 2 deletions czkawka_gui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use glib::Priority;
use gtk4::gio::ApplicationFlags;
use gtk4::prelude::*;
use gtk4::Application;
use log::info;

use connect_things::connect_about_buttons::*;
use connect_things::connect_button_compare::*;
Expand All @@ -33,7 +34,7 @@ use connect_things::connect_selection_of_directories::*;
use connect_things::connect_settings::*;
use connect_things::connect_show_hide_ui::*;
use connect_things::connect_similar_image_size_change::*;
use czkawka_core::common::{get_number_of_threads, set_number_of_threads, setup_logger};
use czkawka_core::common::{get_number_of_threads, print_version_mode, set_number_of_threads, setup_logger};
use czkawka_core::common_dir_traversal::ProgressData;
use czkawka_core::*;
use gui_structs::gui_data::*;
Expand Down Expand Up @@ -72,6 +73,7 @@ fn main() {
let application = Application::new(None::<String>, ApplicationFlags::HANDLES_OPEN | ApplicationFlags::HANDLES_COMMAND_LINE);
application.connect_command_line(move |app, cmdline| {
setup_logger(false);
print_version_mode();
build_ui(app, &cmdline.arguments());
0
});
Expand Down Expand Up @@ -101,7 +103,7 @@ fn build_ui(application: &Application, arguments: &[OsString]) {
arguments,
);
set_number_of_threads(gui_data.settings.scale_settings_number_of_threads.value().round() as usize);
println!("Set thread number to {}", get_number_of_threads());
info!("Set thread number to {}", get_number_of_threads());

// Needs to run when entire GUI is initialized
connect_change_language(&gui_data);
Expand Down

0 comments on commit 42b4a9b

Please sign in to comment.