Mirror of https://git.olaren.dev/Olaren/shitsky

tracing deez nuts

+118 -6
+108 -3
Cargo.lock
··· 287 287 ] 288 288 289 289 [[package]] 290 + name = "lazy_static" 291 + version = "1.5.0" 292 + source = "registry+https://github.com/rust-lang/crates.io-index" 293 + checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" 294 + 295 + [[package]] 290 296 name = "libc" 291 297 version = "0.2.175" 292 298 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 378 384 dependencies = [ 379 385 "libc", 380 386 "wasi", 381 - "windows-sys", 387 + "windows-sys 0.59.0", 388 + ] 389 + 390 + [[package]] 391 + name = "nu-ansi-term" 392 + version = "0.50.1" 393 + source = "registry+https://github.com/rust-lang/crates.io-index" 394 + checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" 395 + dependencies = [ 396 + "windows-sys 0.52.0", 382 397 ] 383 398 384 399 [[package]] ··· 555 570 ] 556 571 557 572 [[package]] 573 + name = "sharded-slab" 574 + version = "0.1.7" 575 + source = "registry+https://github.com/rust-lang/crates.io-index" 576 + checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" 577 + dependencies = [ 578 + "lazy_static", 579 + ] 580 + 581 + [[package]] 558 582 name = "shitsky" 559 583 version = "0.1.0" 560 584 dependencies = [ ··· 562 586 "listenfd", 563 587 "maud", 564 588 "tokio", 589 + "tower-http", 590 + "tracing", 591 + "tracing-subscriber", 565 592 ] 566 593 567 594 [[package]] ··· 592 619 checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" 593 620 dependencies = [ 594 621 "libc", 595 - "windows-sys", 622 + "windows-sys 0.59.0", 596 623 ] 597 624 598 625 [[package]] ··· 613 640 checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" 614 641 615 642 [[package]] 643 + name = "thread_local" 644 + version = "1.1.9" 645 + source = "registry+https://github.com/rust-lang/crates.io-index" 646 + checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" 647 + dependencies = [ 648 + "cfg-if", 649 + ] 650 + 651 + [[package]] 616 652 name = "tokio" 617 653 version = "1.47.1" 618 654 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 629 665 "slab", 630 666 "socket2", 631 667 "tokio-macros", 632 - "windows-sys", 668 + "windows-sys 0.59.0", 633 669 ] 634 670 635 671 [[package]] ··· 660 696 ] 661 697 662 698 [[package]] 699 + name = "tower-http" 700 + version = "0.6.6" 701 + source = "registry+https://github.com/rust-lang/crates.io-index" 702 + checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" 703 + dependencies = [ 704 + "bitflags", 705 + "bytes", 706 + "http", 707 + "http-body", 708 + "pin-project-lite", 709 + "tower-layer", 710 + "tower-service", 711 + "tracing", 712 + ] 713 + 714 + [[package]] 663 715 name = "tower-layer" 664 716 version = "0.3.3" 665 717 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 679 731 dependencies = [ 680 732 "log", 681 733 "pin-project-lite", 734 + "tracing-attributes", 682 735 "tracing-core", 736 + ] 737 + 738 + [[package]] 739 + name = "tracing-attributes" 740 + version = "0.1.30" 741 + source = "registry+https://github.com/rust-lang/crates.io-index" 742 + checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" 743 + dependencies = [ 744 + "proc-macro2", 745 + "quote", 746 + "syn", 683 747 ] 684 748 685 749 [[package]] ··· 689 753 checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" 690 754 dependencies = [ 691 755 "once_cell", 756 + "valuable", 757 + ] 758 + 759 + [[package]] 760 + name = "tracing-log" 761 + version = "0.2.0" 762 + source = "registry+https://github.com/rust-lang/crates.io-index" 763 + checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" 764 + dependencies = [ 765 + "log", 766 + "once_cell", 767 + "tracing-core", 768 + ] 769 + 770 + [[package]] 771 + name = "tracing-subscriber" 772 + version = "0.3.20" 773 + source = "registry+https://github.com/rust-lang/crates.io-index" 774 + checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" 775 + dependencies = [ 776 + "nu-ansi-term", 777 + "sharded-slab", 778 + "smallvec", 779 + "thread_local", 780 + "tracing-core", 781 + "tracing-log", 692 782 ] 693 783 694 784 [[package]] ··· 706 796 "js-sys", 707 797 "wasm-bindgen", 708 798 ] 799 + 800 + [[package]] 801 + name = "valuable" 802 + version = "0.1.1" 803 + source = "registry+https://github.com/rust-lang/crates.io-index" 804 + checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" 709 805 710 806 [[package]] 711 807 name = "version_check" ··· 799 895 version = "0.4.0" 800 896 source = "registry+https://github.com/rust-lang/crates.io-index" 801 897 checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 898 + 899 + [[package]] 900 + name = "windows-sys" 901 + version = "0.52.0" 902 + source = "registry+https://github.com/rust-lang/crates.io-index" 903 + checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 904 + dependencies = [ 905 + "windows-targets", 906 + ] 802 907 803 908 [[package]] 804 909 name = "windows-sys"
+3
Cargo.toml
··· 8 8 listenfd = "1.0.2" 9 9 maud = { version = "0.27", features = ["axum"] } 10 10 tokio = { version = "1.0", features = ["full"] } 11 + tower-http = { version = "0.6", features = ["trace"] } 12 + tracing = "0.1" 13 + tracing-subscriber = "0.3"
+1 -1
justfile
··· 1 1 dev: 2 - systemfd --no-pid -s http::6969 -- watchexec -r -- cargo run 2 + RUST_LOG=trace systemfd --no-pid -s http::6969 -- watchexec -r -- cargo run
+6 -2
src/main.rs
··· 2 2 use listenfd::ListenFd; 3 3 use maud::{DOCTYPE, Markup, html}; 4 4 use tokio::net::TcpListener; 5 + use tower_http::trace::TraceLayer; 5 6 6 7 #[tokio::main] 7 8 async fn main() { 8 - let app = Router::new().route("/", get(index)); 9 + tracing_subscriber::fmt::init(); 9 10 10 - let mut listenfd = ListenFd::from_env(); 11 + let app = Router::new() 12 + .route("/", get(index)) 13 + .layer(TraceLayer::new_for_http()); 11 14 15 + let mut listenfd = ListenFd::from_env(); 12 16 let listener = match listenfd.take_tcp_listener(0).unwrap() { 13 17 // if we are given a tcp listener on listen fd 0, we use that one 14 18 Some(listener) => {