diff options
| author | Yigit Sever | 2021-04-15 23:03:58 +0300 |
|---|---|---|
| committer | Yigit Sever | 2021-04-15 23:03:58 +0300 |
| commit | 44116fd9d5003f4aa041b72491e26356ed47b924 (patch) | |
| tree | 0f3cb3355728a0bee87ebeca215c75bf48aa521a | |
| parent | bf4d0be4aeb639da5daff0e4b5458b769b9f62c1 (diff) | |
| download | gradecoin-44116fd9d5003f4aa041b72491e26356ed47b924.tar.gz gradecoin-44116fd9d5003f4aa041b72491e26356ed47b924.tar.bz2 gradecoin-44116fd9d5003f4aa041b72491e26356ed47b924.zip | |
Switch over to big boy logging
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | Cargo.lock | 258 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | log.conf.yml | 41 | ||||
| -rw-r--r-- | src/bin/main.rs | 3 |
5 files changed, 232 insertions, 75 deletions
| @@ -1,4 +1,5 @@ | |||
| 1 | /target | 1 | log/ |
| 2 | target/ | ||
| 2 | blocks/ | 3 | blocks/ |
| 3 | users/ | 4 | users/ |
| 4 | tags.lock | 5 | tags.lock |
| @@ -41,6 +41,18 @@ dependencies = [ | |||
| 41 | ] | 41 | ] |
| 42 | 42 | ||
| 43 | [[package]] | 43 | [[package]] |
| 44 | name = "anyhow" | ||
| 45 | version = "1.0.40" | ||
| 46 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 47 | checksum = "28b2cd92db5cbd74e8e5028f7e27dd7aa3090e89e4f2a197cc7c8dfb69c7063b" | ||
| 48 | |||
| 49 | [[package]] | ||
| 50 | name = "arc-swap" | ||
| 51 | version = "0.4.8" | ||
| 52 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 53 | checksum = "dabe5a181f83789739c194cbe5a897dde195078fac08568d09221fd6137a7ba8" | ||
| 54 | |||
| 55 | [[package]] | ||
| 44 | name = "arrayvec" | 56 | name = "arrayvec" |
| 45 | version = "0.5.2" | 57 | version = "0.5.2" |
| 46 | source = "registry+https://github.com/rust-lang/crates.io-index" | 58 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -93,17 +105,6 @@ dependencies = [ | |||
| 93 | ] | 105 | ] |
| 94 | 106 | ||
| 95 | [[package]] | 107 | [[package]] |
| 96 | name = "atty" | ||
| 97 | version = "0.2.14" | ||
| 98 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 99 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" | ||
| 100 | dependencies = [ | ||
| 101 | "hermit-abi", | ||
| 102 | "libc", | ||
| 103 | "winapi 0.3.9", | ||
| 104 | ] | ||
| 105 | |||
| 106 | [[package]] | ||
| 107 | name = "autocfg" | 108 | name = "autocfg" |
| 108 | version = "0.1.7" | 109 | version = "0.1.7" |
| 109 | source = "registry+https://github.com/rust-lang/crates.io-index" | 110 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -282,6 +283,17 @@ dependencies = [ | |||
| 282 | ] | 283 | ] |
| 283 | 284 | ||
| 284 | [[package]] | 285 | [[package]] |
| 286 | name = "derivative" | ||
| 287 | version = "2.2.0" | ||
| 288 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 289 | checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" | ||
| 290 | dependencies = [ | ||
| 291 | "proc-macro2", | ||
| 292 | "quote", | ||
| 293 | "syn", | ||
| 294 | ] | ||
| 295 | |||
| 296 | [[package]] | ||
| 285 | name = "digest" | 297 | name = "digest" |
| 286 | version = "0.9.0" | 298 | version = "0.9.0" |
| 287 | source = "registry+https://github.com/rust-lang/crates.io-index" | 299 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -297,19 +309,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 297 | checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" | 309 | checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" |
| 298 | 310 | ||
| 299 | [[package]] | 311 | [[package]] |
| 300 | name = "env_logger" | ||
| 301 | version = "0.6.2" | ||
| 302 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 303 | checksum = "aafcde04e90a5226a6443b7aabdb016ba2f8307c847d524724bd9b346dd1a2d3" | ||
| 304 | dependencies = [ | ||
| 305 | "atty", | ||
| 306 | "humantime", | ||
| 307 | "log", | ||
| 308 | "regex", | ||
| 309 | "termcolor", | ||
| 310 | ] | ||
| 311 | |||
| 312 | [[package]] | ||
| 313 | name = "fnv" | 312 | name = "fnv" |
| 314 | version = "1.0.7" | 313 | version = "1.0.7" |
| 315 | source = "registry+https://github.com/rust-lang/crates.io-index" | 314 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -455,9 +454,9 @@ dependencies = [ | |||
| 455 | "jsonwebtoken", | 454 | "jsonwebtoken", |
| 456 | "lazy_static", | 455 | "lazy_static", |
| 457 | "log", | 456 | "log", |
| 457 | "log4rs", | ||
| 458 | "md-5", | 458 | "md-5", |
| 459 | "parking_lot", | 459 | "parking_lot 0.10.2", |
| 460 | "pretty_env_logger", | ||
| 461 | "rsa", | 460 | "rsa", |
| 462 | "serde", | 461 | "serde", |
| 463 | "serde_json", | 462 | "serde_json", |
| @@ -519,15 +518,6 @@ dependencies = [ | |||
| 519 | ] | 518 | ] |
| 520 | 519 | ||
| 521 | [[package]] | 520 | [[package]] |
| 522 | name = "hermit-abi" | ||
| 523 | version = "0.1.18" | ||
| 524 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 525 | checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" | ||
| 526 | dependencies = [ | ||
| 527 | "libc", | ||
| 528 | ] | ||
| 529 | |||
| 530 | [[package]] | ||
| 531 | name = "hex-literal" | 521 | name = "hex-literal" |
| 532 | version = "0.3.1" | 522 | version = "0.3.1" |
| 533 | source = "registry+https://github.com/rust-lang/crates.io-index" | 523 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -574,12 +564,9 @@ checksum = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e" | |||
| 574 | 564 | ||
| 575 | [[package]] | 565 | [[package]] |
| 576 | name = "humantime" | 566 | name = "humantime" |
| 577 | version = "1.3.0" | 567 | version = "2.1.0" |
| 578 | source = "registry+https://github.com/rust-lang/crates.io-index" | 568 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 579 | checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" | 569 | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" |
| 580 | dependencies = [ | ||
| 581 | "quick-error", | ||
| 582 | ] | ||
| 583 | 570 | ||
| 584 | [[package]] | 571 | [[package]] |
| 585 | name = "hyper" | 572 | name = "hyper" |
| @@ -636,6 +623,15 @@ dependencies = [ | |||
| 636 | ] | 623 | ] |
| 637 | 624 | ||
| 638 | [[package]] | 625 | [[package]] |
| 626 | name = "instant" | ||
| 627 | version = "0.1.9" | ||
| 628 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 629 | checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" | ||
| 630 | dependencies = [ | ||
| 631 | "cfg-if 1.0.0", | ||
| 632 | ] | ||
| 633 | |||
| 634 | [[package]] | ||
| 639 | name = "iovec" | 635 | name = "iovec" |
| 640 | version = "0.1.4" | 636 | version = "0.1.4" |
| 641 | source = "registry+https://github.com/rust-lang/crates.io-index" | 637 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -718,6 +714,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 718 | checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" | 714 | checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" |
| 719 | 715 | ||
| 720 | [[package]] | 716 | [[package]] |
| 717 | name = "linked-hash-map" | ||
| 718 | version = "0.5.4" | ||
| 719 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 720 | checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" | ||
| 721 | |||
| 722 | [[package]] | ||
| 721 | name = "lock_api" | 723 | name = "lock_api" |
| 722 | version = "0.3.4" | 724 | version = "0.3.4" |
| 723 | source = "registry+https://github.com/rust-lang/crates.io-index" | 725 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -727,12 +729,55 @@ dependencies = [ | |||
| 727 | ] | 729 | ] |
| 728 | 730 | ||
| 729 | [[package]] | 731 | [[package]] |
| 732 | name = "lock_api" | ||
| 733 | version = "0.4.3" | ||
| 734 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 735 | checksum = "5a3c91c24eae6777794bb1997ad98bbb87daf92890acab859f7eaa4320333176" | ||
| 736 | dependencies = [ | ||
| 737 | "scopeguard", | ||
| 738 | ] | ||
| 739 | |||
| 740 | [[package]] | ||
| 730 | name = "log" | 741 | name = "log" |
| 731 | version = "0.4.14" | 742 | version = "0.4.14" |
| 732 | source = "registry+https://github.com/rust-lang/crates.io-index" | 743 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 733 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" | 744 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" |
| 734 | dependencies = [ | 745 | dependencies = [ |
| 735 | "cfg-if 1.0.0", | 746 | "cfg-if 1.0.0", |
| 747 | "serde", | ||
| 748 | ] | ||
| 749 | |||
| 750 | [[package]] | ||
| 751 | name = "log-mdc" | ||
| 752 | version = "0.1.0" | ||
| 753 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 754 | checksum = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7" | ||
| 755 | |||
| 756 | [[package]] | ||
| 757 | name = "log4rs" | ||
| 758 | version = "1.0.0" | ||
| 759 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 760 | checksum = "d1572a880d1115ff867396eee7ae2bc924554225e67a0d3c85c745b3e60ca211" | ||
| 761 | dependencies = [ | ||
| 762 | "anyhow", | ||
| 763 | "arc-swap", | ||
| 764 | "chrono", | ||
| 765 | "derivative", | ||
| 766 | "fnv", | ||
| 767 | "humantime", | ||
| 768 | "libc", | ||
| 769 | "log", | ||
| 770 | "log-mdc", | ||
| 771 | "parking_lot 0.11.1", | ||
| 772 | "regex", | ||
| 773 | "serde", | ||
| 774 | "serde-value", | ||
| 775 | "serde_json", | ||
| 776 | "serde_yaml", | ||
| 777 | "thiserror", | ||
| 778 | "thread-id", | ||
| 779 | "typemap", | ||
| 780 | "winapi 0.3.9", | ||
| 736 | ] | 781 | ] |
| 737 | 782 | ||
| 738 | [[package]] | 783 | [[package]] |
| @@ -931,13 +976,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 931 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" | 976 | checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" |
| 932 | 977 | ||
| 933 | [[package]] | 978 | [[package]] |
| 979 | name = "ordered-float" | ||
| 980 | version = "2.1.1" | ||
| 981 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 982 | checksum = "766f840da25490628d8e63e529cd21c014f6600c6b8517add12a6fa6167a6218" | ||
| 983 | dependencies = [ | ||
| 984 | "num-traits", | ||
| 985 | ] | ||
| 986 | |||
| 987 | [[package]] | ||
| 934 | name = "parking_lot" | 988 | name = "parking_lot" |
| 935 | version = "0.10.2" | 989 | version = "0.10.2" |
| 936 | source = "registry+https://github.com/rust-lang/crates.io-index" | 990 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 937 | checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" | 991 | checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" |
| 938 | dependencies = [ | 992 | dependencies = [ |
| 939 | "lock_api", | 993 | "lock_api 0.3.4", |
| 940 | "parking_lot_core", | 994 | "parking_lot_core 0.7.2", |
| 995 | ] | ||
| 996 | |||
| 997 | [[package]] | ||
| 998 | name = "parking_lot" | ||
| 999 | version = "0.11.1" | ||
| 1000 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1001 | checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" | ||
| 1002 | dependencies = [ | ||
| 1003 | "instant", | ||
| 1004 | "lock_api 0.4.3", | ||
| 1005 | "parking_lot_core 0.8.3", | ||
| 941 | ] | 1006 | ] |
| 942 | 1007 | ||
| 943 | [[package]] | 1008 | [[package]] |
| @@ -955,6 +1020,20 @@ dependencies = [ | |||
| 955 | ] | 1020 | ] |
| 956 | 1021 | ||
| 957 | [[package]] | 1022 | [[package]] |
| 1023 | name = "parking_lot_core" | ||
| 1024 | version = "0.8.3" | ||
| 1025 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1026 | checksum = "fa7a782938e745763fe6907fc6ba86946d72f49fe7e21de074e08128a99fb018" | ||
| 1027 | dependencies = [ | ||
| 1028 | "cfg-if 1.0.0", | ||
| 1029 | "instant", | ||
| 1030 | "libc", | ||
| 1031 | "redox_syscall 0.2.6", | ||
| 1032 | "smallvec", | ||
| 1033 | "winapi 0.3.9", | ||
| 1034 | ] | ||
| 1035 | |||
| 1036 | [[package]] | ||
| 958 | name = "pem" | 1037 | name = "pem" |
| 959 | version = "0.8.3" | 1038 | version = "0.8.3" |
| 960 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1039 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1036,17 +1115,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 1036 | checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" | 1115 | checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" |
| 1037 | 1116 | ||
| 1038 | [[package]] | 1117 | [[package]] |
| 1039 | name = "pretty_env_logger" | ||
| 1040 | version = "0.3.1" | ||
| 1041 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1042 | checksum = "717ee476b1690853d222af4634056d830b5197ffd747726a9a1eee6da9f49074" | ||
| 1043 | dependencies = [ | ||
| 1044 | "chrono", | ||
| 1045 | "env_logger", | ||
| 1046 | "log", | ||
| 1047 | ] | ||
| 1048 | |||
| 1049 | [[package]] | ||
| 1050 | name = "proc-macro2" | 1118 | name = "proc-macro2" |
| 1051 | version = "1.0.26" | 1119 | version = "1.0.26" |
| 1052 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1120 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1267,6 +1335,16 @@ dependencies = [ | |||
| 1267 | ] | 1335 | ] |
| 1268 | 1336 | ||
| 1269 | [[package]] | 1337 | [[package]] |
| 1338 | name = "serde-value" | ||
| 1339 | version = "0.7.0" | ||
| 1340 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1341 | checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" | ||
| 1342 | dependencies = [ | ||
| 1343 | "ordered-float", | ||
| 1344 | "serde", | ||
| 1345 | ] | ||
| 1346 | |||
| 1347 | [[package]] | ||
| 1270 | name = "serde_derive" | 1348 | name = "serde_derive" |
| 1271 | version = "1.0.125" | 1349 | version = "1.0.125" |
| 1272 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1350 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1310,6 +1388,18 @@ dependencies = [ | |||
| 1310 | ] | 1388 | ] |
| 1311 | 1389 | ||
| 1312 | [[package]] | 1390 | [[package]] |
| 1391 | name = "serde_yaml" | ||
| 1392 | version = "0.8.17" | ||
| 1393 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1394 | checksum = "15654ed4ab61726bf918a39cb8d98a2e2995b002387807fa6ba58fdf7f59bb23" | ||
| 1395 | dependencies = [ | ||
| 1396 | "dtoa", | ||
| 1397 | "linked-hash-map", | ||
| 1398 | "serde", | ||
| 1399 | "yaml-rust", | ||
| 1400 | ] | ||
| 1401 | |||
| 1402 | [[package]] | ||
| 1313 | name = "sha-1" | 1403 | name = "sha-1" |
| 1314 | version = "0.9.4" | 1404 | version = "0.9.4" |
| 1315 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1405 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1443,15 +1533,6 @@ dependencies = [ | |||
| 1443 | ] | 1533 | ] |
| 1444 | 1534 | ||
| 1445 | [[package]] | 1535 | [[package]] |
| 1446 | name = "termcolor" | ||
| 1447 | version = "1.1.2" | ||
| 1448 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1449 | checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" | ||
| 1450 | dependencies = [ | ||
| 1451 | "winapi-util", | ||
| 1452 | ] | ||
| 1453 | |||
| 1454 | [[package]] | ||
| 1455 | name = "thiserror" | 1536 | name = "thiserror" |
| 1456 | version = "1.0.24" | 1537 | version = "1.0.24" |
| 1457 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1538 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1472,6 +1553,17 @@ dependencies = [ | |||
| 1472 | ] | 1553 | ] |
| 1473 | 1554 | ||
| 1474 | [[package]] | 1555 | [[package]] |
| 1556 | name = "thread-id" | ||
| 1557 | version = "3.3.0" | ||
| 1558 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1559 | checksum = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" | ||
| 1560 | dependencies = [ | ||
| 1561 | "libc", | ||
| 1562 | "redox_syscall 0.1.57", | ||
| 1563 | "winapi 0.3.9", | ||
| 1564 | ] | ||
| 1565 | |||
| 1566 | [[package]] | ||
| 1475 | name = "time" | 1567 | name = "time" |
| 1476 | version = "0.1.43" | 1568 | version = "0.1.43" |
| 1477 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1569 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1599,6 +1691,12 @@ dependencies = [ | |||
| 1599 | ] | 1691 | ] |
| 1600 | 1692 | ||
| 1601 | [[package]] | 1693 | [[package]] |
| 1694 | name = "traitobject" | ||
| 1695 | version = "0.1.0" | ||
| 1696 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1697 | checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079" | ||
| 1698 | |||
| 1699 | [[package]] | ||
| 1602 | name = "try-lock" | 1700 | name = "try-lock" |
| 1603 | version = "0.2.3" | 1701 | version = "0.2.3" |
| 1604 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1702 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1633,6 +1731,15 @@ dependencies = [ | |||
| 1633 | ] | 1731 | ] |
| 1634 | 1732 | ||
| 1635 | [[package]] | 1733 | [[package]] |
| 1734 | name = "typemap" | ||
| 1735 | version = "0.3.3" | ||
| 1736 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1737 | checksum = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6" | ||
| 1738 | dependencies = [ | ||
| 1739 | "unsafe-any", | ||
| 1740 | ] | ||
| 1741 | |||
| 1742 | [[package]] | ||
| 1636 | name = "typenum" | 1743 | name = "typenum" |
| 1637 | version = "1.13.0" | 1744 | version = "1.13.0" |
| 1638 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1745 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1672,6 +1779,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 1672 | checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" | 1779 | checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" |
| 1673 | 1780 | ||
| 1674 | [[package]] | 1781 | [[package]] |
| 1782 | name = "unsafe-any" | ||
| 1783 | version = "0.4.2" | ||
| 1784 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1785 | checksum = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" | ||
| 1786 | dependencies = [ | ||
| 1787 | "traitobject", | ||
| 1788 | ] | ||
| 1789 | |||
| 1790 | [[package]] | ||
| 1675 | name = "untrusted" | 1791 | name = "untrusted" |
| 1676 | version = "0.7.1" | 1792 | version = "0.7.1" |
| 1677 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1793 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1850,15 +1966,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 1850 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" | 1966 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" |
| 1851 | 1967 | ||
| 1852 | [[package]] | 1968 | [[package]] |
| 1853 | name = "winapi-util" | ||
| 1854 | version = "0.1.5" | ||
| 1855 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1856 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" | ||
| 1857 | dependencies = [ | ||
| 1858 | "winapi 0.3.9", | ||
| 1859 | ] | ||
| 1860 | |||
| 1861 | [[package]] | ||
| 1862 | name = "winapi-x86_64-pc-windows-gnu" | 1969 | name = "winapi-x86_64-pc-windows-gnu" |
| 1863 | version = "0.4.0" | 1970 | version = "0.4.0" |
| 1864 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1971 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -1881,6 +1988,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
| 1881 | checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" | 1988 | checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" |
| 1882 | 1989 | ||
| 1883 | [[package]] | 1990 | [[package]] |
| 1991 | name = "yaml-rust" | ||
| 1992 | version = "0.4.5" | ||
| 1993 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1994 | checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" | ||
| 1995 | dependencies = [ | ||
| 1996 | "linked-hash-map", | ||
| 1997 | ] | ||
| 1998 | |||
| 1999 | [[package]] | ||
| 1884 | name = "zeroize" | 2000 | name = "zeroize" |
| 1885 | version = "1.2.0" | 2001 | version = "1.2.0" |
| 1886 | source = "registry+https://github.com/rust-lang/crates.io-index" | 2002 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| @@ -12,7 +12,7 @@ tokio = { version = "0.2.9", features = ["macros"] } | |||
| 12 | serde = { version = "1.0.104", features = ["derive"] } | 12 | serde = { version = "1.0.104", features = ["derive"] } |
| 13 | chrono = { version = "0.4.10", features = ["serde"] } | 13 | chrono = { version = "0.4.10", features = ["serde"] } |
| 14 | log = "0.4.8" | 14 | log = "0.4.8" |
| 15 | pretty_env_logger = "0.3.1" | 15 | log4rs = "1.0.0" |
| 16 | parking_lot = "0.10.0" | 16 | parking_lot = "0.10.0" |
| 17 | serde_json = "1.0.59" | 17 | serde_json = "1.0.59" |
| 18 | lazy_static = "1.4.0" | 18 | lazy_static = "1.4.0" |
diff --git a/log.conf.yml b/log.conf.yml new file mode 100644 index 0000000..1940669 --- /dev/null +++ b/log.conf.yml | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | # Scan this file for changes every 2 minutes | ||
| 2 | refresh_rate: 2 minutes | ||
| 3 | |||
| 4 | appenders: | ||
| 5 | # An appender named "stdout" that writes to stdout with pretty colours | ||
| 6 | stdout: | ||
| 7 | kind: console | ||
| 8 | encoder: | ||
| 9 | pattern: "[{d(%Y-%m-%d %H:%M:%S)} {h({l})}] - {m}\n" | ||
| 10 | |||
| 11 | # And this guy writes to file, also rolls the files (when they get too large) | ||
| 12 | gradecoin: | ||
| 13 | kind: rolling_file | ||
| 14 | path: "log/gradecoin.log" | ||
| 15 | append: true | ||
| 16 | encoder: | ||
| 17 | kind: pattern | ||
| 18 | pattern: "[{d(%Y-%m-%d %H:%M:%S)} {l}] - {m}\n" | ||
| 19 | |||
| 20 | policy: | ||
| 21 | kind: compound | ||
| 22 | |||
| 23 | trigger: | ||
| 24 | kind: size | ||
| 25 | limit: 4 mb | ||
| 26 | |||
| 27 | roller: | ||
| 28 | kind: fixed_window | ||
| 29 | pattern: "log/gradecoin.{}.old.log" | ||
| 30 | count: 5 | ||
| 31 | base: 1 | ||
| 32 | |||
| 33 | loggers: | ||
| 34 | gradecoin: | ||
| 35 | level: info | ||
| 36 | appenders: | ||
| 37 | - stdout | ||
| 38 | - gradecoin | ||
| 39 | additive: false | ||
| 40 | |||
| 41 | |||
diff --git a/src/bin/main.rs b/src/bin/main.rs index 8b61e5c..882fdc6 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs | |||
| @@ -10,11 +10,10 @@ use gradecoin::schema::create_database; | |||
| 10 | #[tokio::main] | 10 | #[tokio::main] |
| 11 | async fn main() { | 11 | async fn main() { |
| 12 | // Show debug logs by default by setting `RUST_LOG=gradecoin=debug` | 12 | // Show debug logs by default by setting `RUST_LOG=gradecoin=debug` |
| 13 | // TODO: write logs to file? <13-04-21, yigit> // | ||
| 14 | if env::var_os("RUST_LOG").is_none() { | 13 | if env::var_os("RUST_LOG").is_none() { |
| 15 | env::set_var("RUST_LOG", "gradecoin=debug"); | 14 | env::set_var("RUST_LOG", "gradecoin=debug"); |
| 16 | } | 15 | } |
| 17 | pretty_env_logger::init(); | 16 | log4rs::init_file("log.conf.yml", Default::default()).unwrap(); |
| 18 | 17 | ||
| 19 | let db = create_database(); | 18 | let db = create_database(); |
| 20 | 19 | ||
