feat: Add logger to Zellij
We add log4rs create for logging across Zellij. Additionally, we capture `stderr` output from plugins and log it the same log file as other Zellij logs.
This commit is contained in:
parent
974edc2c98
commit
0c570a52f5
12 changed files with 416 additions and 59 deletions
301
Cargo.lock
generated
301
Cargo.lock
generated
|
|
@ -17,6 +17,15 @@ version = "1.0.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.18"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ansi_term"
|
||||
version = "0.11.0"
|
||||
|
|
@ -35,6 +44,18 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "15af2628f6890fe2609a3b91bef4c83450512802e59489f9c1cb1fa5df064a61"
|
||||
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dabe5a181f83789739c194cbe5a897dde195078fac08568d09221fd6137a7ba8"
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.5.2"
|
||||
|
|
@ -216,7 +237,7 @@ dependencies = [
|
|||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object 0.25.2",
|
||||
"object 0.25.3",
|
||||
"rustc-demangle",
|
||||
]
|
||||
|
||||
|
|
@ -297,6 +318,19 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
"time",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.33.3"
|
||||
|
|
@ -582,6 +616,17 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derivative"
|
||||
version = "2.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "directories-next"
|
||||
version = "2.0.0"
|
||||
|
|
@ -644,9 +689,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "erased-serde"
|
||||
version = "0.3.15"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5b36e6f2295f393f44894c6031f67df4d185b984cd54d08f768ce678007efcd"
|
||||
checksum = "3de9ad4541d99dc22b59134e7ff8dc3d6c988c89ecd7324bf10a8362b07a2afa"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
|
@ -866,9 +911,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.9.1"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
|
||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
|
|
@ -881,13 +926,19 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.18"
|
||||
version = "0.1.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
|
||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "ident_case"
|
||||
version = "1.0.1"
|
||||
|
|
@ -896,9 +947,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
|||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.6.2"
|
||||
version = "1.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "824845a0bf897a9042383849b02c1bc219c2383772efcd5c6f9766fa4b81aef3"
|
||||
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"hashbrown",
|
||||
|
|
@ -1013,9 +1064,9 @@ checksum = "3576a87f2ba00f6f106fdfcd16db1d698d648a26ad8e0573cad8537c3c362d2a"
|
|||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.95"
|
||||
version = "0.2.97"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "789da6d93f1b866ffe175afc5322a4d76c038605a1c3319bb57b06967ca98a36"
|
||||
checksum = "12b8adadd720df158f4d70dfe7ccc6adb0472d7c55ca83445f6a5ab3e36f8fb6"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
|
|
@ -1084,9 +1135,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"serde",
|
||||
"value-bag",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log-mdc"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7"
|
||||
|
||||
[[package]]
|
||||
name = "log4rs"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d1572a880d1115ff867396eee7ae2bc924554225e67a0d3c85c745b3e60ca211"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arc-swap",
|
||||
"chrono",
|
||||
"derivative",
|
||||
"fnv",
|
||||
"humantime",
|
||||
"libc",
|
||||
"log",
|
||||
"log-mdc",
|
||||
"parking_lot 0.11.1",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde-value",
|
||||
"serde_json",
|
||||
"serde_yaml",
|
||||
"thiserror",
|
||||
"thread-id",
|
||||
"typemap",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mach"
|
||||
version = "0.3.2"
|
||||
|
|
@ -1132,9 +1217,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.7.11"
|
||||
version = "0.7.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf80d3e903b34e0bd7282b218398aec54e082c840d9baf8339e0080a0c542956"
|
||||
checksum = "8c2bdb6314ec10835cd3293dd268473a835c02b7b352e788be788b3c6ca6bb16"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
|
|
@ -1188,6 +1273,25 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.13.0"
|
||||
|
|
@ -1216,24 +1320,24 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.25.2"
|
||||
version = "0.25.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f8bc1d42047cf336f0f939c99e97183cf31551bf0f2865a2ec9c8d91fd4ffb5e"
|
||||
checksum = "a38f2be3697a57b4060074ff41b44c16870d916ad7877c17696e063257482bc7"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.7.2"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
|
||||
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
||||
|
||||
[[package]]
|
||||
name = "openssl-sys"
|
||||
version = "0.9.63"
|
||||
version = "0.9.65"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b6b0d6fb7d80f877617dfcb014e605e2b5ab2fb0afdf27935219bb6bd984cb98"
|
||||
checksum = "7a7907e3bfa08bb85105209cdfcb6c63d109f8f6c1ed6ca318fff5c1853fbc1d"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cc",
|
||||
|
|
@ -1242,6 +1346,15 @@ dependencies = [
|
|||
"vcpkg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ordered-float"
|
||||
version = "2.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f100fcfb41e5385e0991f74981732049f9b896821542a219420491046baafdc2"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking"
|
||||
version = "2.0.0"
|
||||
|
|
@ -1292,16 +1405,16 @@ dependencies = [
|
|||
"cfg-if 1.0.0",
|
||||
"instant",
|
||||
"libc",
|
||||
"redox_syscall 0.2.8",
|
||||
"redox_syscall 0.2.9",
|
||||
"smallvec",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.6"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc0e1f259c92177c30a4c9d177246edd0a3568b25756a977d0632cf8fa37e905"
|
||||
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
|
|
@ -1317,14 +1430,14 @@ checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
|
|||
|
||||
[[package]]
|
||||
name = "polling"
|
||||
version = "2.0.3"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4fc12d774e799ee9ebae13f4076ca003b40d18a11ac0f3641e6f899618580b7b"
|
||||
checksum = "92341d779fa34ea8437ef4d82d440d5e1ce3f3ff7f824aa64424cd481f9a1f25"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"log",
|
||||
"wepoll-sys",
|
||||
"wepoll-ffi",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
|
|
@ -1423,24 +1536,24 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.8.3"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
|
||||
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_chacha",
|
||||
"rand_core 0.6.2",
|
||||
"rand_core 0.6.3",
|
||||
"rand_hc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_chacha"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
|
||||
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||
dependencies = [
|
||||
"ppv-lite86",
|
||||
"rand_core 0.6.2",
|
||||
"rand_core 0.6.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1460,20 +1573,20 @@ checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
|||
|
||||
[[package]]
|
||||
name = "rand_core"
|
||||
version = "0.6.2"
|
||||
version = "0.6.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
|
||||
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_hc"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
|
||||
checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
|
||||
dependencies = [
|
||||
"rand_core 0.6.2",
|
||||
"rand_core 0.6.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1518,9 +1631,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
|
|||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.2.8"
|
||||
version = "0.2.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc"
|
||||
checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
|
@ -1531,7 +1644,7 @@ version = "0.1.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f"
|
||||
dependencies = [
|
||||
"redox_syscall 0.2.8",
|
||||
"redox_syscall 0.2.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1541,7 +1654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
|
||||
dependencies = [
|
||||
"getrandom",
|
||||
"redox_syscall 0.2.8",
|
||||
"redox_syscall 0.2.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1555,6 +1668,23 @@ dependencies = [
|
|||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.5.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||
|
||||
[[package]]
|
||||
name = "region"
|
||||
version = "2.2.0"
|
||||
|
|
@ -1578,9 +1708,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustc-demangle"
|
||||
version = "0.1.19"
|
||||
version = "0.1.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "410f7acf3cb3a44527c5d9546bad4bf4e6c460915d5f9f2fc524498bfe8f70ce"
|
||||
checksum = "dead70b0b5e03e9c814bcb6b01e03e68f7c57a80aa48c72ec92152ab3e818d49"
|
||||
|
||||
[[package]]
|
||||
name = "rustc-hash"
|
||||
|
|
@ -1609,6 +1739,16 @@ dependencies = [
|
|||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde-value"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c"
|
||||
dependencies = [
|
||||
"ordered-float",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_bytes"
|
||||
version = "0.11.5"
|
||||
|
|
@ -1821,9 +1961,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.72"
|
||||
version = "1.0.73"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1e8cdbefb79a9a5a65e0db8b47b723ee907b7c7f8496c76a1770b5c310bab82"
|
||||
checksum = "f71489ff30030d2ae598524f61326b902466f72a0fb1a8564c001cc63425bcc7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
@ -1854,8 +1994,8 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
|
|||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"libc",
|
||||
"rand 0.8.3",
|
||||
"redox_syscall 0.2.8",
|
||||
"rand 0.8.4",
|
||||
"redox_syscall 0.2.9",
|
||||
"remove_dir_all",
|
||||
"winapi",
|
||||
]
|
||||
|
|
@ -1889,7 +2029,7 @@ checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e"
|
|||
dependencies = [
|
||||
"libc",
|
||||
"numtoa",
|
||||
"redox_syscall 0.2.8",
|
||||
"redox_syscall 0.2.9",
|
||||
"redox_termios",
|
||||
]
|
||||
|
||||
|
|
@ -1922,6 +2062,17 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread-id"
|
||||
version = "3.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"redox_syscall 0.1.57",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.43"
|
||||
|
|
@ -1965,6 +2116,21 @@ dependencies = [
|
|||
"lazy_static",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "traitobject"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079"
|
||||
|
||||
[[package]]
|
||||
name = "typemap"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6"
|
||||
dependencies = [
|
||||
"unsafe-any",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typetag"
|
||||
version = "0.1.7"
|
||||
|
|
@ -2007,6 +2173,15 @@ version = "0.2.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
||||
[[package]]
|
||||
name = "unsafe-any"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f"
|
||||
dependencies = [
|
||||
"traitobject",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.1.1"
|
||||
|
|
@ -2037,9 +2212,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "vcpkg"
|
||||
version = "0.2.13"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "025ce40a007e1907e58d5bc1a594def78e5573bb0b1160bc389634e8f12e4faa"
|
||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
||||
|
||||
[[package]]
|
||||
name = "vec_map"
|
||||
|
|
@ -2102,6 +2277,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
|
|
@ -2363,18 +2540,18 @@ checksum = "87cc2fe6350834b4e528ba0901e7aa405d78b89dc1fa3145359eb4de0e323fcf"
|
|||
|
||||
[[package]]
|
||||
name = "wast"
|
||||
version = "35.0.2"
|
||||
version = "36.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ef140f1b49946586078353a453a1d28ba90adfc54dde75710bc1931de204d68"
|
||||
checksum = "8b5d7ba374a364571da1cb0a379a3dc302582a2d9937a183bfe35b68ad5bb9c4"
|
||||
dependencies = [
|
||||
"leb128",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wat"
|
||||
version = "1.0.37"
|
||||
version = "1.0.38"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ec280a739b69173e0ffd12c1658507996836ba4e992ed9bc1e5385a0bd72a02"
|
||||
checksum = "16383df7f0e3901484c2dda6294ed6895caa3627ce4f6584141dcf30a33a23e6"
|
||||
dependencies = [
|
||||
"wast",
|
||||
]
|
||||
|
|
@ -2390,10 +2567,10 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "wepoll-sys"
|
||||
version = "3.0.1"
|
||||
name = "wepoll-ffi"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0fcb14dea929042224824779fbc82d9fab8d2e6d3cbc0ac404de8edf489e77ff"
|
||||
checksum = "d743fdedc5c64377b5fc2bc036b01c7fd642205a0d96356034ae3404d49eb7fb"
|
||||
dependencies = [
|
||||
"cc",
|
||||
]
|
||||
|
|
@ -2444,8 +2621,9 @@ name = "zellij"
|
|||
version = "0.14.0"
|
||||
dependencies = [
|
||||
"insta",
|
||||
"log",
|
||||
"names",
|
||||
"rand 0.8.3",
|
||||
"rand 0.8.4",
|
||||
"ssh2",
|
||||
"zellij-client",
|
||||
"zellij-server",
|
||||
|
|
@ -2469,8 +2647,13 @@ dependencies = [
|
|||
"cassowary",
|
||||
"daemonize",
|
||||
"insta",
|
||||
"log",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"typetag",
|
||||
"unicode-width",
|
||||
"wasm-bindgen",
|
||||
"wasmer",
|
||||
"wasmer-wasi",
|
||||
"zellij-utils",
|
||||
|
|
@ -2480,6 +2663,7 @@ dependencies = [
|
|||
name = "zellij-tile"
|
||||
version = "0.14.0"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"strum",
|
||||
|
|
@ -2506,6 +2690,8 @@ dependencies = [
|
|||
"interprocess",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
"log4rs",
|
||||
"nix",
|
||||
"once_cell",
|
||||
"serde",
|
||||
|
|
@ -2516,6 +2702,7 @@ dependencies = [
|
|||
"strum",
|
||||
"tempfile",
|
||||
"termion",
|
||||
"typetag",
|
||||
"vte 0.10.1",
|
||||
"zellij-tile",
|
||||
]
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ names = "0.11.0"
|
|||
zellij-client = { path = "zellij-client/", version = "0.14.0" }
|
||||
zellij-server = { path = "zellij-server/", version = "0.14.0" }
|
||||
zellij-utils = { path = "zellij-utils/", version = "0.14.0" }
|
||||
log = "0.4.14"
|
||||
|
||||
[dev-dependencies]
|
||||
insta = { version = "1.6.0", features = ["backtrace"] }
|
||||
|
|
|
|||
|
|
@ -9,11 +9,14 @@ register_plugin!(State);
|
|||
|
||||
impl ZellijPlugin for State {
|
||||
fn load(&mut self) {
|
||||
dbg!("hello from load");
|
||||
refresh_directory(self);
|
||||
subscribe(&[EventType::KeyPress]);
|
||||
}
|
||||
|
||||
fn update(&mut self, event: Event) {
|
||||
dbg!("hello from update");
|
||||
|
||||
if let Event::KeyPress(key) = event {
|
||||
match key {
|
||||
Key::Up | Key::Char('k') => {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ mod sessions;
|
|||
mod tests;
|
||||
|
||||
use crate::install::populate_data_dir;
|
||||
use log::info;
|
||||
use sessions::{assert_session, assert_session_ne, get_active_session, list_sessions};
|
||||
use std::convert::TryFrom;
|
||||
use std::process;
|
||||
|
|
@ -21,6 +22,8 @@ use zellij_utils::{
|
|||
};
|
||||
|
||||
pub fn main() {
|
||||
configure_logger();
|
||||
info!("Hello Zellij!");
|
||||
let opts = CliArgs::from_args();
|
||||
|
||||
if let Some(Command::Sessions(Sessions::ListSessions)) = opts.command {
|
||||
|
|
|
|||
|
|
@ -16,8 +16,13 @@ serde_json = "1.0"
|
|||
unicode-width = "0.1.8"
|
||||
wasmer = "1.0.0"
|
||||
wasmer-wasi = "1.0.0"
|
||||
wasm-bindgen = { version = "0.2", features = ["serde-serialize"] }
|
||||
cassowary = "0.3.0"
|
||||
zellij-utils = { path = "../zellij-utils/", version = "0.14.0" }
|
||||
log = "0.4.14"
|
||||
serde_derive = "1.0.80"
|
||||
serde = "1.0.126"
|
||||
typetag = "0.1.7"
|
||||
|
||||
[dev-dependencies]
|
||||
insta = "1.6.0"
|
||||
|
|
|
|||
94
zellij-server/src/decorating_pipe.rs
Normal file
94
zellij-server/src/decorating_pipe.rs
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
use std::{
|
||||
collections::VecDeque,
|
||||
io::{Read, Seek, Write},
|
||||
};
|
||||
|
||||
use log::info;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use wasmer_wasi::{WasiFile, WasiFsError};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct DecoratingPipe {
|
||||
buffer: VecDeque<u8>,
|
||||
plugin_name: String,
|
||||
}
|
||||
|
||||
impl DecoratingPipe {
|
||||
pub fn new(plugin_name: &str) -> DecoratingPipe {
|
||||
info!("Creating decorating pipe!");
|
||||
dbg!("Creating the decorating pipe :)");
|
||||
DecoratingPipe {
|
||||
buffer: VecDeque::new(),
|
||||
plugin_name: String::from(plugin_name),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Read for DecoratingPipe {
|
||||
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
||||
let amt = std::cmp::min(buf.len(), self.buffer.len());
|
||||
for (i, byte) in self.buffer.drain(..amt).enumerate() {
|
||||
buf[i] = byte;
|
||||
}
|
||||
Ok(amt)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: do this better. We're not sure about byte boundaries and endl stuff but, we do expect
|
||||
// to get the valid thing eventually
|
||||
impl Write for DecoratingPipe {
|
||||
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||
self.buffer.extend(buf);
|
||||
let current_chunk = std::str::from_utf8(buf).unwrap();
|
||||
for c in current_chunk.chars() {
|
||||
if c == '\n' {
|
||||
info!(
|
||||
"{}: {}",
|
||||
self.plugin_name,
|
||||
std::str::from_utf8(&self.buffer.make_contiguous().split_last().unwrap().1)
|
||||
.unwrap()
|
||||
);
|
||||
self.buffer.clear();
|
||||
}
|
||||
}
|
||||
Ok(buf.len())
|
||||
}
|
||||
fn flush(&mut self) -> std::io::Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl Seek for DecoratingPipe {
|
||||
fn seek(&mut self, _pos: std::io::SeekFrom) -> std::io::Result<u64> {
|
||||
Err(std::io::Error::new(
|
||||
std::io::ErrorKind::Other,
|
||||
"can not seek in a pipe",
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
#[typetag::serde]
|
||||
impl WasiFile for DecoratingPipe {
|
||||
fn last_accessed(&self) -> u64 {
|
||||
0
|
||||
}
|
||||
fn last_modified(&self) -> u64 {
|
||||
0
|
||||
}
|
||||
fn created_time(&self) -> u64 {
|
||||
0
|
||||
}
|
||||
fn size(&self) -> u64 {
|
||||
self.buffer.len() as u64
|
||||
}
|
||||
fn set_len(&mut self, len: u64) -> Result<(), WasiFsError> {
|
||||
self.buffer.resize(len as usize, 0);
|
||||
Ok(())
|
||||
}
|
||||
fn unlink(&mut self) -> Result<(), WasiFsError> {
|
||||
Ok(())
|
||||
}
|
||||
fn bytes_available(&self) -> Result<usize, WasiFsError> {
|
||||
Ok(self.buffer.len())
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ pub mod os_input_output;
|
|||
pub mod panes;
|
||||
pub mod tab;
|
||||
|
||||
mod decorating_pipe;
|
||||
mod pty;
|
||||
mod route;
|
||||
mod screen;
|
||||
|
|
@ -9,6 +10,7 @@ mod thread_bus;
|
|||
mod ui;
|
||||
mod wasm_vm;
|
||||
|
||||
use log::info;
|
||||
use zellij_utils::zellij_tile;
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
|
@ -108,6 +110,7 @@ pub(crate) enum SessionState {
|
|||
}
|
||||
|
||||
pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||
info!("starts server");
|
||||
#[cfg(not(any(feature = "test", test)))]
|
||||
daemonize::Daemonize::new()
|
||||
.working_directory(std::env::current_dir().unwrap())
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
use log::info;
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::fs;
|
||||
use std::io::{Read, Write};
|
||||
use std::path::PathBuf;
|
||||
use std::process;
|
||||
use std::str::FromStr;
|
||||
|
|
@ -9,7 +12,6 @@ use std::time::{Duration, Instant};
|
|||
|
||||
use zellij_utils::{serde, zellij_tile};
|
||||
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use wasmer::{
|
||||
imports, ChainableNamedResolver, Function, ImportObject, Instance, Module, Store, Value,
|
||||
WasmerEnv,
|
||||
|
|
@ -18,6 +20,7 @@ use wasmer_wasi::{Pipe, WasiEnv, WasiState};
|
|||
use zellij_tile::data::{Event, EventType, PluginIds};
|
||||
|
||||
use crate::{
|
||||
decorating_pipe::DecoratingPipe,
|
||||
panes::PaneId,
|
||||
pty::PtyInstruction,
|
||||
screen::ScreenInstruction,
|
||||
|
|
@ -56,6 +59,7 @@ pub(crate) struct PluginEnv {
|
|||
|
||||
// Thread main --------------------------------------------------------------------------------------------------------
|
||||
pub(crate) fn wasm_thread_main(bus: Bus<PluginInstruction>, store: Store, data_dir: PathBuf) {
|
||||
info!("Wasm create thread :))");
|
||||
let mut plugin_id = 0;
|
||||
let mut plugin_map = HashMap::new();
|
||||
loop {
|
||||
|
|
@ -74,6 +78,8 @@ pub(crate) fn wasm_thread_main(bus: Bus<PluginInstruction>, store: Store, data_d
|
|||
|
||||
let output = Pipe::new();
|
||||
let input = Pipe::new();
|
||||
let stderr =
|
||||
DecoratingPipe::new(path.as_path().file_name().unwrap().to_str().unwrap());
|
||||
let mut wasi_env = WasiState::new("Zellij")
|
||||
.env("CLICOLOR_FORCE", "1")
|
||||
.preopen(|p| {
|
||||
|
|
@ -86,6 +92,7 @@ pub(crate) fn wasm_thread_main(bus: Bus<PluginInstruction>, store: Store, data_d
|
|||
.unwrap()
|
||||
.stdin(Box::new(input))
|
||||
.stdout(Box::new(output))
|
||||
.stderr(Box::new(stderr))
|
||||
.finalize()
|
||||
.unwrap();
|
||||
|
||||
|
|
|
|||
|
|
@ -11,3 +11,4 @@ serde = { version = "1.0", features = ["derive"] }
|
|||
serde_json = "1.0"
|
||||
strum = "0.20.0"
|
||||
strum_macros = "0.20.0"
|
||||
log = "0.4.14"
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ strum = "0.20.0"
|
|||
termion = "1.5.0"
|
||||
vte = "0.10.1"
|
||||
zellij-tile = { path = "../zellij-tile/", version = "0.14.0" }
|
||||
log = "0.4.14"
|
||||
typetag = "0.1.7"
|
||||
log4rs = "1.0.0"
|
||||
|
||||
[dependencies.async-std]
|
||||
version = "1.3.0"
|
||||
|
|
|
|||
42
zellij-utils/assets/config/log4rs.yml
Normal file
42
zellij-utils/assets/config/log4rs.yml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
# Scan this file for changes every 30 seconds
|
||||
refresh_rate: 30 seconds
|
||||
|
||||
appenders:
|
||||
# An appender named "stdout" that writes to stdout
|
||||
stderr:
|
||||
kind: console
|
||||
target: stderr
|
||||
|
||||
logFile:
|
||||
kind: file
|
||||
path: "zellij.log"
|
||||
append: false
|
||||
encoder:
|
||||
pattern: "{h(|{M}| {d} {l} [{T}] [{f}:{L}]: {m})} {n}"
|
||||
|
||||
logPlugin:
|
||||
kind: file
|
||||
path: "zellij.log"
|
||||
encoder:
|
||||
pattern: "{m} {n}"
|
||||
|
||||
# An appender named "requests" that writes to a file with a custom pattern encoder
|
||||
requests:
|
||||
kind: file
|
||||
path: "requests.log"
|
||||
encoder:
|
||||
pattern: "{d} - {m}{n}"
|
||||
|
||||
# Set the default logging level to "warn" and attach the "stdout" appender to the root
|
||||
root:
|
||||
level: info
|
||||
appenders:
|
||||
- logFile
|
||||
|
||||
loggers:
|
||||
# Raise the maximum log level for events sent to the "app::backend::db" logger to "info"
|
||||
zellij_server::decorating_pipe:
|
||||
level: trace
|
||||
appenders:
|
||||
- logPlugin
|
||||
additive: false
|
||||
|
|
@ -1,15 +1,23 @@
|
|||
//! Zellij logging utility functions.
|
||||
|
||||
use std::{
|
||||
fs,
|
||||
fs::{self, OpenOptions},
|
||||
io::{self, prelude::*},
|
||||
os::unix::io::RawFd,
|
||||
path::{Path, PathBuf},
|
||||
thread,
|
||||
};
|
||||
|
||||
use log::info;
|
||||
|
||||
use crate::consts::{ZELLIJ_TMP_LOG_DIR, ZELLIJ_TMP_LOG_FILE};
|
||||
use crate::shared::set_permissions;
|
||||
|
||||
pub fn configure_logger() {
|
||||
log4rs::init_file("zellij-utils/assets/config/log4rs.yml", Default::default()).unwrap();
|
||||
info!("Zellij logger initialized");
|
||||
}
|
||||
|
||||
pub fn atomic_create_file(file_name: &Path) -> io::Result<()> {
|
||||
let _ = fs::OpenOptions::new()
|
||||
.append(true)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue