summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2023-10-15 00:07:03 +0200
committerHampusM <hampus@hampusmat.com>2023-10-15 00:07:03 +0200
commit1abf0f04f3de26f62eecf0881056575c089c4533 (patch)
tree2ce3a6b73091ab2010c5aaae1c4b0db533528ba5
parentda329909f93597970afd169cee28ece3bee7127b (diff)
feat: add logging
-rw-r--r--Cargo.lock75
-rw-r--r--Cargo.toml4
-rw-r--r--src/main.rs8
3 files changed, 86 insertions, 1 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 461fbd7..ed47841 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -118,6 +118,8 @@ name = "game-newest"
version = "0.1.0"
dependencies = [
"engine",
+ "tracing",
+ "tracing-subscriber",
]
[[package]]
@@ -233,12 +235,28 @@ dependencies = [
]
[[package]]
+name = "nu-ansi-term"
+version = "0.46.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
+dependencies = [
+ "overload",
+ "winapi",
+]
+
+[[package]]
name = "once_cell"
version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d"
[[package]]
+name = "overload"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
+
+[[package]]
name = "peeking_take_while"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -327,12 +345,27 @@ dependencies = [
]
[[package]]
+name = "sharded-slab"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
+dependencies = [
+ "lazy_static",
+]
+
+[[package]]
name = "shlex"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380"
[[package]]
+name = "smallvec"
+version = "1.11.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a"
+
+[[package]]
name = "syn"
version = "2.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -364,6 +397,16 @@ dependencies = [
]
[[package]]
+name = "thread_local"
+version = "1.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152"
+dependencies = [
+ "cfg-if",
+ "once_cell",
+]
+
+[[package]]
name = "tracing"
version = "0.1.39"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -392,6 +435,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
dependencies = [
"once_cell",
+ "valuable",
+]
+
+[[package]]
+name = "tracing-log"
+version = "0.1.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
+dependencies = [
+ "lazy_static",
+ "log",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-subscriber"
+version = "0.3.17"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77"
+dependencies = [
+ "nu-ansi-term",
+ "sharded-slab",
+ "smallvec",
+ "thread_local",
+ "tracing-core",
+ "tracing-log",
]
[[package]]
@@ -401,6 +470,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
+name = "valuable"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
+
+[[package]]
name = "which"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 50f82e0..9baf278 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,4 +7,6 @@ edition = "2021"
members = ["glfw", "engine"]
[dependencies]
-engine = { path = "./engine" }
+engine = { path = "./engine", features = ["debug"] }
+tracing = "0.1.39"
+tracing-subscriber = "0.3.17"
diff --git a/src/main.rs b/src/main.rs
index aa492a3..ebdf491 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,6 +5,8 @@ use engine::object::Object;
use engine::vector::Vec3;
use engine::vertex::Builder as VertexBuilder;
use engine::{Engine, WindowSize};
+use tracing::Level;
+use tracing_subscriber::FmtSubscriber;
const WINDOW_SIZE: WindowSize = WindowSize {
width: 500,
@@ -13,6 +15,12 @@ const WINDOW_SIZE: WindowSize = WindowSize {
fn main() -> Result<(), Box<dyn Error>>
{
+ let subscriber = FmtSubscriber::builder()
+ .with_max_level(Level::TRACE)
+ .finish();
+
+ tracing::subscriber::set_global_default(subscriber)?;
+
let engine = Engine::new(&WINDOW_SIZE, "Yaaay lmao")?;
let triangle = Object::new(&[