fixing a lot of debug info

This commit is contained in:
Chris Cochrun 2024-03-25 18:35:58 -05:00
parent 64e10dd765
commit 428386a25b
4 changed files with 72 additions and 40 deletions

View file

@ -978,8 +978,8 @@ impl song_model::SongModel {
for (i, line) in raw_lyrics.split("\n").enumerate() {
if keywords.contains(&line) {
if i != 0 {
println!("{verse_title}");
println!("{lyric}");
// println!("{verse_title}");
// println!("{lyric}");
lyric_map.insert(verse_title, lyric);
lyric = String::from("");
verse_title = line.to_string();
@ -996,25 +996,25 @@ impl song_model::SongModel {
}
}
lyric_map.insert(verse_title, lyric);
println!("da-map: {:?}", lyric_map);
// println!("da-map: {:?}", lyric_map);
for mut verse in vorder {
let mut verse_name = "";
debug!(verse = verse);
// debug!(verse = verse);
for word in keywords.clone() {
let end_verse =
verse.get(1..2).unwrap_or_default();
let beg_verse =
verse.get(0..1).unwrap_or_default();
println!(
"verse: {:?}, beginning: {:?}, end: {:?}, word: {:?}",
verse, beg_verse, end_verse, word
);
// println!(
// "verse: {:?}, beginning: {:?}, end: {:?}, word: {:?}",
// verse, beg_verse, end_verse, word
// );
if word.starts_with(beg_verse)
&& word.ends_with(end_verse)
{
verse_name = word;
println!("TITLE: {verse_name}");
// println!("TITLE: {verse_name}");
continue;
}
}
@ -1036,7 +1036,8 @@ impl song_model::SongModel {
};
}
for lyric in lyric_list.iter() {
println!("da-list: {:?}", lyric);
// println!("da-list: {:?}", lyric);
debug!(lyric = ?lyric)
}
}
QStringList::from(&lyric_list)

View file

@ -2,11 +2,14 @@ use std::pin::Pin;
use time::macros::format_description;
use tokio::runtime::Runtime;
use tracing::{debug, info};
use tracing_subscriber::{
fmt::{self, time::LocalTime},
EnvFilter,
};
use self::utilities::QString;
mod db {
use diesel::{Connection, SqliteConnection};
use dirs::data_local_dir;
@ -50,6 +53,11 @@ mod db {
#[cxx_qt::bridge]
mod utilities {
unsafe extern "C++" {
include!("cxx-qt-lib/qstring.h");
type QString = cxx_qt_lib::QString;
}
unsafe extern "RustQt" {
#[qobject]
#[qml_element]
@ -57,6 +65,12 @@ mod utilities {
#[qinvokable]
fn setup(self: Pin<&mut Utils>);
#[qinvokable]
fn dbg(self: &Utils, message: QString);
#[qinvokable]
fn inf(self: &Utils, message: QString);
}
}
@ -74,9 +88,17 @@ impl Default for UtilsRust {
}
impl utilities::Utils {
pub fn setup(mut self: Pin<&mut Self>) {
pub fn setup(self: Pin<&mut Self>) {
crate::utils::setup();
}
pub fn dbg(self: &Self, message: QString) {
debug!(msg = ?message);
}
pub fn inf(self: &Self, message: QString) {
info!(msg = ?message);
}
}
pub fn setup() {