feat: basic triangle rendering

This commit is contained in:
Chance 2025-04-16 01:24:10 +00:00 committed by BitSyndicate
parent f215c10d0e
commit 43f8f46021
Signed by: bitsyndicate
GPG key ID: 443E4198D6BBA6DE
11 changed files with 1828 additions and 67 deletions

View file

@ -0,0 +1,6 @@
[package]
name = "renderer"
version = "0.1.0"
edition = "2024"
[dependencies]

View file

@ -0,0 +1 @@

View file

@ -1,6 +1,7 @@
use crate::LogLevel;
use std::path::{Path, PathBuf};
use crate::LogLevel;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct LoggerConfig {
pub(crate) log_level: LogLevel,
@ -17,26 +18,32 @@ impl LoggerConfig {
self.log_level = level;
self
}
pub fn log_to_file(mut self, f: bool) -> Self {
self.log_to_file = f;
self
}
pub fn colored_stdout(mut self, c: bool) -> Self {
self.stdout_color = c;
self
}
pub fn log_to_stdout(mut self, s: bool) -> Self {
self.log_to_stdout = s;
self
}
pub fn log_path<P: AsRef<Path>>(mut self, p: P) -> Self {
self.log_file_path = p.as_ref().to_path_buf();
self
}
pub fn stdout_include_time(mut self, i: bool) -> Self {
self.stdout_include_time = i;
self
}
pub fn file_include_time(mut self, i: bool) -> Self {
self.file_include_time = i;
self

View file

@ -3,8 +3,6 @@ pub mod query;
#[cfg(test)]
mod tests;
use config::LoggerConfig;
use query::LogQuery;
use std::{
fmt,
fs::OpenOptions,
@ -17,6 +15,9 @@ use std::{
thread,
time::SystemTime,
};
use config::LoggerConfig;
use query::LogQuery;
use tracing::{Event, Level, Subscriber};
use tracing_subscriber::{
layer::{Context, Layer, SubscriberExt},
@ -161,6 +162,7 @@ impl fmt::Display for LogLevel {
impl FromStr for LogLevel {
type Err = ();
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"trace" => Ok(Self::Trace),

View file

@ -1,10 +1,12 @@
use super::*;
use pretty_assertions::assert_eq;
use tracing::Level;
use super::*;
#[test]
fn test_logger_sequential_consistency() {
use std::sync::atomic::{AtomicUsize, Ordering};
use tracing::{debug, error, info, trace, warn};
let config = LoggerConfig::default()