diff --git a/Cargo.lock b/Cargo.lock index 6804bd08c..187383e3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -86,11 +86,6 @@ name = "build_const" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "byteorder" -version = "1.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "bzip2" version = "0.3.3" @@ -131,16 +126,6 @@ name = "cfg-if" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "chrono" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "clap" version = "2.32.0" @@ -242,6 +227,17 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "env_logger" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "error-chain" version = "0.12.0" @@ -346,6 +342,14 @@ dependencies = [ "uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "humantime" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "indicatif" version = "0.9.0" @@ -357,17 +361,6 @@ dependencies = [ "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "isatty" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "itoa" version = "0.4.3" @@ -420,6 +413,14 @@ dependencies = [ "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "log" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "memchr" version = "2.1.1" @@ -472,19 +473,6 @@ name = "nodrop" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "num-integer" -version = "0.1.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "num-traits" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "openssl" version = "0.10.15" @@ -578,6 +566,11 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "quick-error" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "quote" version = "0.6.9" @@ -774,33 +767,6 @@ name = "siphasher" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "slog" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "slog-async" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "slog-term" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "smallvec" version = "0.6.5" @@ -871,11 +837,6 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "take_mut" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "tar" version = "0.4.17" @@ -910,20 +871,19 @@ dependencies = [ ] [[package]] -name = "term" -version = "0.5.1" +name = "termcolor" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "termcolor" -version = "0.3.6" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1049,21 +1009,20 @@ dependencies = [ "console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "human-panic 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)", "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1105,6 +1064,14 @@ name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -1118,6 +1085,15 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "wincolor" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "xattr" version = "0.2.2" @@ -1150,13 +1126,11 @@ dependencies = [ "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" "checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" -"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" "checksum bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b" "checksum bzip2-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2c5162604199bbb17690ede847eaa6120a3f33d5ab4dcc8e7c25b16d849ae79b" "checksum cargo_metadata 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1aaa1a9856ae2d188340526d0986feb6899c9ad11c5dfd73453c784fed6e373d" "checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" -"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" "checksum clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f84dec9bc083ce2503908cd305af98bd363da6f54bf8d4bf0ac14ee749ad5d1" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" @@ -1166,6 +1140,7 @@ dependencies = [ "checksum curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)" = "a9e5285b49b44401518c947d3b808d14d99a538a6c9ffb3ec0205c11f9fc4389" "checksum curl-sys 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "08459503c415173da1ce6b41036a37b8bfdd86af46d45abb9964d4c61fe670ef" "checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" +"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" "checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" @@ -1178,8 +1153,8 @@ dependencies = [ "checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum human-panic 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "21638c5955a6daf3ecc42cae702335fc37a72a4abcc6959ce457b31a7d43bbdd" +"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e" "checksum indicatif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a29b2fa6f00010c268bface64c18bb0310aaa70d46a195d5382d288c477fb016" -"checksum isatty 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e31a8281fc93ec9693494da65fbf28c0c2aa60a2eaec25dc58e2f31952e95edc" "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" @@ -1187,14 +1162,13 @@ dependencies = [ "checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe" "checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a" +"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16" "checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" "checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c" "checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e" "checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729" "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" -"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" -"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum openssl 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)" = "5e1309181cdcbdb51bc3b6bedb33dfac2a83b3d585033d3f6d9e22e8c1928613" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" "checksum openssl-src 111.0.1+1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d1edaed888fd85a54a2646bf02992931ddefdda3b1a748fc79f088a8db27fcbe" @@ -1206,6 +1180,7 @@ dependencies = [ "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" "checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee" +"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "63b5829244f52738cfee93b3a165c1911388675be000c888d2fae620dee8fa5b" "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" @@ -1231,9 +1206,6 @@ dependencies = [ "checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" "checksum serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "43344e7ce05d0d8280c5940cabb4964bea626aa58b1ec0e8c73fa2a8512a38ce" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" -"checksum slog 2.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1e1a2eec401952cd7b12a84ea120e2d57281329940c3f93c2bf04f462539508e" -"checksum slog-async 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e544d16c6b230d84c866662fe55e31aacfca6ae71e6fc49ae9a311cb379bfc2f" -"checksum slog-term 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5951a808c40f419922ee014c15b6ae1cd34d963538b57d8a4778b9ca3fff1e0b" "checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d" "checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" @@ -1242,12 +1214,11 @@ dependencies = [ "checksum structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5352090cfae7a2c85e1a31146268b53396106c88ca5d6ccee2e3fae83b6e35c2" "checksum syn 0.15.18 (registry+https://github.com/rust-lang/crates.io-index)" = "90c39a061e2f412a9f869540471ab679e85e50c6b05604daf28bc3060f75c430" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" -"checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum tar 0.4.17 (registry+https://github.com/rust-lang/crates.io-index)" = "83b0d14b53dbfd62681933fadd651e815f99e6084b649e049ab99296e05ab3de" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "55c1195ef8513f3273d55ff59fe5da6940287a0d7a98331254397f464833675b" -"checksum term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" "checksum termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "adc4587ead41bf016f11af03e55a624c06568b5a19db4e90fde573d805074f83" +"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625" "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" @@ -1270,7 +1241,9 @@ dependencies = [ "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum wincolor 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eeb06499a3a4d44302791052df005d5232b927ed1a9658146d842165c4de7767" +"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" "checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" "checksum zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "36b9e08fb518a65cf7e08a1e482573eb87a2f4f8c6619316612a3c1f162fe822" diff --git a/Cargo.toml b/Cargo.toml index b486071b6..0128facac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,21 +15,20 @@ cargo_metadata = "0.6.0" console = "0.6.1" curl = "0.4.13" dirs = "1.0.4" +env_logger = { version = "0.5.13", default-features = false } failure = "0.1.2" flate2 = "1.0.2" hex = "0.3" human-panic = "1.0.1" indicatif = "0.9.0" lazy_static = "1.1.0" +log = "0.4.6" openssl = { version = '0.10.11', optional = true } parking_lot = "0.6" serde = "1.0.74" serde_derive = "1.0.74" serde_json = "1.0.26" siphasher = "0.2.3" -slog = "2.3" -slog-term = "2.4" -slog-async = "2.3" structopt = "0.2" tar = "0.4.16" toml = "0.4" diff --git a/src/bindgen.rs b/src/bindgen.rs index 46ce8a47a..3dfee343f 100644 --- a/src/bindgen.rs +++ b/src/bindgen.rs @@ -5,8 +5,9 @@ use cargo_metadata; use child; use emoji; use failure::{self, ResultExt}; +use log::{info, warn}; use progressbar::Step; -use slog::Logger; +use log::debug; use std::fs; use std::path::{Path, PathBuf}; use std::process::Command; @@ -25,7 +26,6 @@ pub fn install_wasm_bindgen( version: &str, install_permitted: bool, step: &Step, - log: &Logger, ) -> Result { // If `wasm-bindgen` is installed globally and it has the right version, use // that. Assume that other tools are installed next to it. @@ -34,11 +34,10 @@ pub fn install_wasm_bindgen( // `cargo install`, for example. if let Ok(path) = which("wasm-bindgen") { debug!( - log, "found global wasm-bindgen binary at: {}", path.display() ); - if wasm_bindgen_version_check(&path, version, log) { + if wasm_bindgen_version_check(&path, version) { return Ok(Download::at(path.parent().unwrap())); } } @@ -51,14 +50,13 @@ pub fn install_wasm_bindgen( Ok(dl) => return Ok(dl), Err(e) => { warn!( - log, "could not download pre-built `wasm-bindgen`: {}. Falling back to `cargo install`.", e ); } } - cargo_install_wasm_bindgen(log, &cache, version, install_permitted) + cargo_install_wasm_bindgen(&cache, version, install_permitted) } /// Downloads a precompiled copy of wasm-bindgen, if available. @@ -101,7 +99,6 @@ fn prebuilt_url(version: &str) -> Option { /// Use `cargo install` to install the `wasm-bindgen` CLI locally into the given /// crate. pub fn cargo_install_wasm_bindgen( - logger: &Logger, cache: &Cache, version: &str, install_permitted: bool, @@ -131,7 +128,7 @@ pub fn cargo_install_wasm_bindgen( .arg("--root") .arg(&tmp); - child::run(logger, cmd, "cargo install").context("Installing wasm-bindgen with cargo")?; + child::run(cmd, "cargo install").context("Installing wasm-bindgen with cargo")?; fs::rename(&tmp, &destination)?; Ok(Download::at(&destination)) @@ -148,7 +145,6 @@ pub fn wasm_bindgen_build( target: &str, debug: bool, step: &Step, - log: &Logger, ) -> Result<(), failure::Error> { let msg = format!("{}Running WASM-bindgen...", emoji::RUNNER); PBAR.step(step, &msg); @@ -192,15 +188,15 @@ pub fn wasm_bindgen_build( cmd.arg("--debug"); } - child::run(log, cmd, "wasm-bindgen").context("Running the wasm-bindgen CLI")?; + child::run(cmd, "wasm-bindgen").context("Running the wasm-bindgen CLI")?; Ok(()) } /// Check if the `wasm-bindgen` dependency is locally satisfied. -fn wasm_bindgen_version_check(bindgen_path: &PathBuf, dep_version: &str, log: &Logger) -> bool { +fn wasm_bindgen_version_check(bindgen_path: &PathBuf, dep_version: &str) -> bool { let mut cmd = Command::new(bindgen_path); cmd.arg("--version"); - child::run(log, cmd, "wasm-bindgen") + child::run(cmd, "wasm-bindgen") .map(|stdout| { stdout .trim() @@ -208,10 +204,8 @@ fn wasm_bindgen_version_check(bindgen_path: &PathBuf, dep_version: &str, log: &L .nth(1) .map(|v| { info!( - log, "Checking installed `wasm-bindgen` version == expected version: {} == {}", - v, - dep_version + v, dep_version ); v == dep_version }) diff --git a/src/build.rs b/src/build.rs index cb8f95b5b..d5cc21ec6 100644 --- a/src/build.rs +++ b/src/build.rs @@ -5,7 +5,6 @@ use emoji; use error::Error; use failure::ResultExt; use progressbar::Step; -use slog::Logger; use std::path::Path; use std::process::Command; use std::str; @@ -57,23 +56,17 @@ fn rustc_minor_version() -> Option { /// Ensure that `rustup` has the `wasm32-unknown-unknown` target installed for /// current toolchain -pub fn rustup_add_wasm_target(log: &Logger, step: &Step) -> Result<(), failure::Error> { +pub fn rustup_add_wasm_target(step: &Step) -> Result<(), failure::Error> { let msg = format!("{}Adding WASM target...", emoji::TARGET); PBAR.step(step, &msg); let mut cmd = Command::new("rustup"); cmd.arg("target").arg("add").arg("wasm32-unknown-unknown"); - child::run(log, cmd, "rustup") - .context("Adding the wasm32-unknown-unknown target with rustup")?; + child::run(cmd, "rustup").context("Adding the wasm32-unknown-unknown target with rustup")?; Ok(()) } /// Run `cargo build` targetting `wasm32-unknown-unknown`. -pub fn cargo_build_wasm( - log: &Logger, - path: &Path, - debug: bool, - step: &Step, -) -> Result<(), failure::Error> { +pub fn cargo_build_wasm(path: &Path, debug: bool, step: &Step) -> Result<(), failure::Error> { let msg = format!("{}Compiling to WASM...", emoji::CYCLONE); PBAR.step(step, &msg); let mut cmd = Command::new("cargo"); @@ -82,22 +75,18 @@ pub fn cargo_build_wasm( cmd.arg("--release"); } cmd.arg("--target").arg("wasm32-unknown-unknown"); - child::run(log, cmd, "cargo build").context("Compiling your crate to WebAssembly failed")?; + child::run(cmd, "cargo build").context("Compiling your crate to WebAssembly failed")?; Ok(()) } /// Run `cargo build --tests` targetting `wasm32-unknown-unknown`. -pub fn cargo_build_wasm_tests( - log: &Logger, - path: &Path, - debug: bool, -) -> Result<(), failure::Error> { +pub fn cargo_build_wasm_tests(path: &Path, debug: bool) -> Result<(), failure::Error> { let mut cmd = Command::new("cargo"); cmd.current_dir(path).arg("build").arg("--tests"); if !debug { cmd.arg("--release"); } cmd.arg("--target").arg("wasm32-unknown-unknown"); - child::run(log, cmd, "cargo build").context("Compilation of your program failed")?; + child::run(cmd, "cargo build").context("Compilation of your program failed")?; Ok(()) } diff --git a/src/child.rs b/src/child.rs index 23c3f4c37..39c5f6034 100644 --- a/src/child.rs +++ b/src/child.rs @@ -5,7 +5,7 @@ use error::Error; use failure; -use slog::Logger; +use log::info; use std::{ io::{self, Read}, mem, process, string, @@ -116,12 +116,8 @@ where } /// Run the given command and return its stdout. -pub fn run( - logger: &Logger, - mut command: process::Command, - command_name: &str, -) -> Result { - info!(logger, "Running {:?}", command); +pub fn run(mut command: process::Command, command_name: &str) -> Result { + info!("Running {:?}", command); let mut child = command .stdout(process::Stdio::piped()) @@ -145,11 +141,11 @@ pub fn run( thread::spawn(move || read_and_send(stderr, stderr_send, OutputFragment::Stderr)); let mut stdout = OutputAccumulator::new(|line| { - info!(logger, "{} (stdout): {}", command_name, line); + info!("{} (stdout): {}", command_name, line); PBAR.message(line) }); let mut stderr = OutputAccumulator::new(|line| { - info!(logger, "{} (stderr): {}", command_name, line); + info!("{} (stderr): {}", command_name, line); PBAR.message(line) }); diff --git a/src/command/build.rs b/src/command/build.rs index 12381fe50..c22ed21c9 100644 --- a/src/command/build.rs +++ b/src/command/build.rs @@ -8,10 +8,10 @@ use emoji; use error::Error; use indicatif::HumanDuration; use lockfile::Lockfile; +use log::info; use manifest; use progressbar::Step; use readme; -use slog::Logger; use std::path::PathBuf; use std::str::FromStr; use std::time::Instant; @@ -98,7 +98,7 @@ pub struct BuildOptions { pub out_dir: String, } -type BuildStep = fn(&mut Build, &Step, &Logger) -> Result<(), failure::Error>; +type BuildStep = fn(&mut Build, &Step) -> Result<(), failure::Error>; impl Build { /// Construct a build command from the given options. @@ -128,7 +128,7 @@ impl Build { } /// Execute this `Build` command. - pub fn run(&mut self, log: &Logger) -> Result<(), failure::Error> { + pub fn run(&mut self) -> Result<(), failure::Error> { let process_steps = Build::get_process_steps(&self.mode); let mut step_counter = Step::new(process_steps.len()); @@ -136,16 +136,13 @@ impl Build { let started = Instant::now(); for (_, process_step) in process_steps { - process_step(self, &step_counter, log)?; + process_step(self, &step_counter)?; step_counter.inc(); } let duration = HumanDuration(started.elapsed()); - info!(&log, "Done in {}.", &duration); - info!( - &log, - "Your wasm pkg is ready to publish at {:#?}.", &self.out_dir - ); + info!("Done in {}.", &duration); + info!("Your wasm pkg is ready to publish at {:#?}.", &self.out_dir); PBAR.message(&format!("{} Done in {}", emoji::SPARKLE, &duration)); @@ -199,38 +196,33 @@ impl Build { } } - fn step_check_rustc_version( - &mut self, - step: &Step, - log: &Logger, - ) -> Result<(), failure::Error> { - info!(&log, "Checking rustc version..."); + fn step_check_rustc_version(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Checking rustc version..."); let version = build::check_rustc_version(step)?; let msg = format!("rustc version is {}.", version); - info!(&log, "{}", &msg); + info!("{}", &msg); Ok(()) } - fn step_check_crate_config(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { - info!(&log, "Checking crate configuration..."); + fn step_check_crate_config(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Checking crate configuration..."); manifest::check_crate_config(&self.crate_path, step)?; - info!(&log, "Crate is correctly configured."); + info!("Crate is correctly configured."); Ok(()) } - fn step_add_wasm_target(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { - info!(&log, "Adding wasm-target..."); - build::rustup_add_wasm_target(log, step)?; - info!(&log, "Adding wasm-target was successful."); + fn step_add_wasm_target(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Adding wasm-target..."); + build::rustup_add_wasm_target(step)?; + info!("Adding wasm-target was successful."); Ok(()) } - fn step_build_wasm(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { - info!(&log, "Building wasm..."); - build::cargo_build_wasm(log, &self.crate_path, self.debug, step)?; + fn step_build_wasm(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Building wasm..."); + build::cargo_build_wasm(&self.crate_path, self.debug, step)?; info!( - &log, "wasm built at {:#?}.", &self .crate_path @@ -241,15 +233,15 @@ impl Build { Ok(()) } - fn step_create_dir(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { - info!(&log, "Creating a pkg directory..."); + fn step_create_dir(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Creating a pkg directory..."); create_pkg_dir(&self.out_dir, step)?; - info!(&log, "Created a pkg directory at {:#?}.", &self.crate_path); + info!("Created a pkg directory at {:#?}.", &self.crate_path); Ok(()) } - fn step_create_json(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { - info!(&log, "Writing a package.json..."); + fn step_create_json(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Writing a package.json..."); manifest::write_package_json( &self.crate_path, &self.out_dir, @@ -259,29 +251,24 @@ impl Build { step, )?; info!( - &log, "Wrote a package.json at {:#?}.", &self.out_dir.join("package.json") ); Ok(()) } - fn step_copy_readme(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { - info!(&log, "Copying readme from crate..."); + fn step_copy_readme(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Copying readme from crate..."); readme::copy_from_crate(&self.crate_path, &self.out_dir, step)?; - info!(&log, "Copied readme from crate to {:#?}.", &self.out_dir); + info!("Copied readme from crate to {:#?}.", &self.out_dir); Ok(()) } - fn step_install_wasm_bindgen( - &mut self, - step: &Step, - log: &Logger, - ) -> Result<(), failure::Error> { - info!(&log, "Identifying wasm-bindgen dependency..."); + fn step_install_wasm_bindgen(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Identifying wasm-bindgen dependency..."); let lockfile = Lockfile::new(&self.crate_path)?; let bindgen_version = lockfile.require_wasm_bindgen()?; - info!(&log, "Installing wasm-bindgen-cli..."); + info!("Installing wasm-bindgen-cli..."); let install_permitted = match self.mode { BuildMode::Normal => true, BuildMode::Force => true, @@ -292,15 +279,13 @@ impl Build { &bindgen_version, install_permitted, step, - log, )?; self.bindgen = Some(bindgen); - info!(&log, "Installing wasm-bindgen-cli was successful."); + info!("Installing wasm-bindgen-cli was successful."); - info!(&log, "Getting the crate name from the manifest..."); + info!("Getting the crate name from the manifest..."); self.crate_name = manifest::get_crate_name(&self.crate_path)?; info!( - &log, "Got crate name {:#?} from the manifest at {:#?}.", &self.crate_name, &self.crate_path.join("Cargo.toml") @@ -308,8 +293,8 @@ impl Build { Ok(()) } - fn step_run_wasm_bindgen(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { - info!(&log, "Building the wasm bindings..."); + fn step_run_wasm_bindgen(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Building the wasm bindings..."); bindgen::wasm_bindgen_build( &self.crate_path, self.bindgen.as_ref().unwrap(), @@ -319,9 +304,8 @@ impl Build { &self.target, self.debug, step, - log, )?; - info!(&log, "wasm bindings were built at {:#?}.", &self.out_dir); + info!("wasm bindings were built at {:#?}.", &self.out_dir); Ok(()) } } diff --git a/src/command/login.rs b/src/command/login.rs index a660cb9e3..0ee09c3d9 100644 --- a/src/command/login.rs +++ b/src/command/login.rs @@ -1,5 +1,5 @@ +use log::info; use npm; -use slog::Logger; use std::result; use PBAR; @@ -8,22 +8,17 @@ pub fn login( scope: Option, always_auth: bool, auth_type: Option, - log: &Logger, ) -> result::Result<(), failure::Error> { let registry = registry.unwrap_or(npm::DEFAULT_NPM_REGISTRY.to_string()); - info!(&log, "Logging in to npm..."); + info!("Logging in to npm..."); info!( - &log, "Scope: {:?} Registry: {}, Always Auth: {}, Auth Type: {:?}.", - &scope, - ®istry, - always_auth, - &auth_type + &scope, ®istry, always_auth, &auth_type ); - info!(&log, "npm info located in the npm debug log"); - npm::npm_login(log, ®istry, &scope, always_auth, &auth_type)?; - info!(&log, "Logged you in!"); + info!("npm info located in the npm debug log"); + npm::npm_login(®istry, &scope, always_auth, &auth_type)?; + info!("Logged you in!"); PBAR.message(&format!("👋 logged you in!")); Ok(()) diff --git a/src/command/mod.rs b/src/command/mod.rs index ee418da4c..cb7f0a7cc 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -14,7 +14,7 @@ use self::pack::pack; use self::publish::{access::Access, publish}; use self::test::{Test, TestOptions}; use error::Error; -use slog::Logger; +use log::{error, info}; use std::path::PathBuf; use std::result; use PBAR; @@ -84,23 +84,23 @@ pub enum Command { } /// Run a command with the given logger! -pub fn run_wasm_pack(command: Command, log: &Logger) -> result::Result<(), failure::Error> { +pub fn run_wasm_pack(command: Command) -> result::Result<(), failure::Error> { // Run the correct command based off input and store the result of it so that we can clear // the progress bar then return it let status = match command { Command::Build(build_opts) => { - info!(&log, "Running build command..."); - Build::try_from_opts(build_opts).and_then(|mut b| b.run(&log)) + info!("Running build command..."); + Build::try_from_opts(build_opts).and_then(|mut b| b.run()) } Command::Pack { path } => { - info!(&log, "Running pack command..."); - info!(&log, "Path: {:?}", &path); - pack(path, &log) + info!("Running pack command..."); + info!("Path: {:?}", &path); + pack(path) } Command::Publish { path, access } => { - info!(&log, "Running publish command..."); - info!(&log, "Path: {:?}", &path); - publish(path, access, &log) + info!("Running publish command..."); + info!("Path: {:?}", &path); + publish(path, access) } Command::Login { registry, @@ -108,27 +108,23 @@ pub fn run_wasm_pack(command: Command, log: &Logger) -> result::Result<(), failu always_auth, auth_type, } => { - info!(&log, "Running login command..."); + info!("Running login command..."); info!( - &log, "Registry: {:?}, Scope: {:?}, Always Auth: {}, Auth Type: {:?}", - ®istry, - &scope, - &always_auth, - &auth_type + ®istry, &scope, &always_auth, &auth_type ); - login(registry, scope, always_auth, auth_type, &log) + login(registry, scope, always_auth, auth_type) } Command::Test(test_opts) => { - info!(&log, "Running test command..."); - Test::try_from_opts(test_opts).and_then(|t| t.run(&log)) + info!("Running test command..."); + Test::try_from_opts(test_opts).and_then(|t| t.run()) } }; match status { Ok(_) => {} Err(ref e) => { - error!(&log, "{}", e); + error!("{}", e); for c in e.iter_chain() { if let Some(e) = c.downcast_ref::() { PBAR.error(e.error_type()); diff --git a/src/command/pack.rs b/src/command/pack.rs index f4820fc6b..e4fe81bda 100644 --- a/src/command/pack.rs +++ b/src/command/pack.rs @@ -1,29 +1,25 @@ use command::utils::{find_pkg_directory, set_crate_path}; use error::Error; +use log::info; use npm; -use slog::Logger; use std::path::PathBuf; use std::result; use PBAR; /// Executes the 'npm pack' command on the 'pkg' directory /// which creates a tarball that can be published to the NPM registry -pub fn pack(path: Option, log: &Logger) -> result::Result<(), failure::Error> { +pub fn pack(path: Option) -> result::Result<(), failure::Error> { let crate_path = set_crate_path(path)?; - info!(&log, "Packing up the npm package..."); + info!("Packing up the npm package..."); let pkg_directory = find_pkg_directory(&crate_path).ok_or(Error::PkgNotFound { message: format!( "Unable to find the pkg directory at path {:#?}, or in a child directory of {:#?}", &crate_path, &crate_path ), })?; - npm::npm_pack(log, &pkg_directory.to_string_lossy())?; - info!( - &log, - "Your package is located at {:#?}", - crate_path.join("pkg") - ); + npm::npm_pack(&pkg_directory.to_string_lossy())?; + info!("Your package is located at {:#?}", crate_path.join("pkg")); PBAR.message("🎒 packed up your package!"); Ok(()) diff --git a/src/command/publish/mod.rs b/src/command/publish/mod.rs index 8e1acb69f..726c2ce76 100644 --- a/src/command/publish/mod.rs +++ b/src/command/publish/mod.rs @@ -4,8 +4,8 @@ pub mod access; use self::access::Access; use command::utils::{find_pkg_directory, set_crate_path}; use error::Error; +use log::info; use npm; -use slog::Logger; use std::path::PathBuf; use std::result; use PBAR; @@ -15,12 +15,11 @@ use PBAR; pub fn publish( path: Option, access: Option, - log: &Logger, ) -> result::Result<(), failure::Error> { let crate_path = set_crate_path(path)?; - info!(&log, "Publishing the npm package..."); - info!(&log, "npm info located in the npm debug log"); + info!("Publishing the npm package..."); + info!("npm info located in the npm debug log"); let pkg_directory = find_pkg_directory(&crate_path).ok_or(Error::PkgNotFound { message: format!( "Unable to find the pkg directory at path '{:#?}', or in a child directory of '{:#?}'", @@ -28,8 +27,8 @@ pub fn publish( ), })?; - npm::npm_publish(log, &pkg_directory.to_string_lossy(), access)?; - info!(&log, "Published your package!"); + npm::npm_publish(&pkg_directory.to_string_lossy(), access)?; + info!("Published your package!"); PBAR.message("💥 published your package!"); Ok(()) diff --git a/src/command/test.rs b/src/command/test.rs index 0c31dac6e..0dbd97316 100644 --- a/src/command/test.rs +++ b/src/command/test.rs @@ -10,9 +10,9 @@ use emoji; use error::Error; use indicatif::HumanDuration; use lockfile::Lockfile; +use log::info; use manifest; use progressbar::Step; -use slog::Logger; use std::path::PathBuf; use std::time::Instant; use test::{self, webdriver}; @@ -96,7 +96,7 @@ pub struct Test { test_runner_path: Option, } -type TestStep = fn(&mut Test, &Step, &Logger) -> Result<(), failure::Error>; +type TestStep = fn(&mut Test, &Step) -> Result<(), failure::Error>; impl Test { /// Construct a test command from the given options. @@ -163,17 +163,17 @@ impl Test { } /// Execute this test command. - pub fn run(mut self, log: &Logger) -> Result<(), failure::Error> { + pub fn run(mut self) -> Result<(), failure::Error> { let process_steps = self.get_process_steps(); let mut step_counter = Step::new(process_steps.len()); let started = Instant::now(); for (_, process_step) in process_steps { - process_step(&mut self, &step_counter, log)?; + process_step(&mut self, &step_counter)?; step_counter.inc(); } let duration = HumanDuration(started.elapsed()); - info!(&log, "Done in {}.", &duration); + info!("Done in {}.", &duration); Ok(()) } @@ -235,49 +235,41 @@ impl Test { } } - fn step_check_rustc_version( - &mut self, - step: &Step, - log: &Logger, - ) -> Result<(), failure::Error> { - info!(log, "Checking rustc version..."); + fn step_check_rustc_version(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Checking rustc version..."); let _ = build::check_rustc_version(step)?; - info!(log, "Rustc version is correct."); + info!("Rustc version is correct."); Ok(()) } - fn step_check_crate_config(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { - info!(log, "Checking crate configuration..."); + fn step_check_crate_config(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Checking crate configuration..."); manifest::check_crate_config(&self.crate_path, step)?; - info!(log, "Crate is correctly configured."); + info!("Crate is correctly configured."); Ok(()) } - fn step_add_wasm_target(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { - info!(&log, "Adding wasm-target..."); - build::rustup_add_wasm_target(log, step)?; - info!(&log, "Adding wasm-target was successful."); + fn step_add_wasm_target(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Adding wasm-target..."); + build::rustup_add_wasm_target(step)?; + info!("Adding wasm-target was successful."); Ok(()) } - fn step_build_tests(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { - info!(log, "Compiling tests to wasm..."); + fn step_build_tests(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Compiling tests to wasm..."); let msg = format!("{}Compiling tests to WASM...", emoji::CYCLONE); PBAR.step(step, &msg); - build::cargo_build_wasm_tests(log, &self.crate_path, !self.release)?; + build::cargo_build_wasm_tests(&self.crate_path, !self.release)?; - info!(log, "Finished compiling tests to wasm."); + info!("Finished compiling tests to wasm."); Ok(()) } - fn step_install_wasm_bindgen( - &mut self, - step: &Step, - log: &Logger, - ) -> Result<(), failure::Error> { - info!(&log, "Identifying wasm-bindgen dependency..."); + fn step_install_wasm_bindgen(&mut self, step: &Step) -> Result<(), failure::Error> { + info!("Identifying wasm-bindgen dependency..."); let lockfile = Lockfile::new(&self.crate_path)?; let bindgen_version = lockfile.require_wasm_bindgen()?; @@ -298,15 +290,15 @@ impl Test { let install_permitted = match self.mode { BuildMode::Normal => { - info!(&log, "Ensuring wasm-bindgen-cli is installed..."); + info!("Ensuring wasm-bindgen-cli is installed..."); true } BuildMode::Force => { - info!(&log, "Ensuring wasm-bindgen-cli is installed..."); + info!("Ensuring wasm-bindgen-cli is installed..."); true } BuildMode::Noinstall => { - info!(&log, "Searching for existing wasm-bindgen-cli install..."); + info!("Searching for existing wasm-bindgen-cli install..."); false } }; @@ -316,33 +308,31 @@ impl Test { &bindgen_version, install_permitted, step, - log, )?; self.test_runner_path = Some(dl.binary("wasm-bindgen-test-runner")); - info!(&log, "Getting wasm-bindgen-cli was successful."); + info!("Getting wasm-bindgen-cli was successful."); Ok(()) } - fn step_test_node(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { + fn step_test_node(&mut self, step: &Step) -> Result<(), failure::Error> { assert!(self.node); - info!(log, "Running tests in node..."); + info!("Running tests in node..."); PBAR.step(step, "Running tests in node..."); test::cargo_test_wasm( &self.crate_path, self.release, - log, Some(( "CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER", &self.test_runner_path.as_ref().unwrap(), )), )?; - info!(log, "Finished running tests in node."); + info!("Finished running tests in node."); Ok(()) } - fn step_get_chromedriver(&mut self, step: &Step, _log: &Logger) -> Result<(), failure::Error> { + fn step_get_chromedriver(&mut self, step: &Step) -> Result<(), failure::Error> { PBAR.step(step, "Getting chromedriver..."); assert!(self.chrome && self.chromedriver.is_none()); @@ -353,14 +343,14 @@ impl Test { Ok(()) } - fn step_test_chrome(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { + fn step_test_chrome(&mut self, step: &Step) -> Result<(), failure::Error> { PBAR.step(step, "Running tests in Chrome..."); let chromedriver = self.chromedriver.as_ref().unwrap().display().to_string(); let chromedriver = chromedriver.as_str(); info!( - log, - "Running tests in Chrome with chromedriver at {}", chromedriver + "Running tests in Chrome with chromedriver at {}", + chromedriver ); let test_runner = self @@ -370,7 +360,7 @@ impl Test { .display() .to_string(); let test_runner = test_runner.as_str(); - info!(log, "Using wasm-bindgen test runner at {}", test_runner); + info!("Using wasm-bindgen test runner at {}", test_runner); let mut envs = vec![ ("CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER", test_runner), @@ -380,11 +370,11 @@ impl Test { envs.push(("NO_HEADLESS", "1")); } - test::cargo_test_wasm(&self.crate_path, self.release, log, envs)?; + test::cargo_test_wasm(&self.crate_path, self.release, envs)?; Ok(()) } - fn step_get_geckodriver(&mut self, step: &Step, _log: &Logger) -> Result<(), failure::Error> { + fn step_get_geckodriver(&mut self, step: &Step) -> Result<(), failure::Error> { PBAR.step(step, "Getting geckodriver..."); assert!(self.firefox && self.geckodriver.is_none()); @@ -395,14 +385,14 @@ impl Test { Ok(()) } - fn step_test_firefox(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { + fn step_test_firefox(&mut self, step: &Step) -> Result<(), failure::Error> { PBAR.step(step, "Running tests in Firefox..."); let geckodriver = self.geckodriver.as_ref().unwrap().display().to_string(); let geckodriver = geckodriver.as_str(); info!( - log, - "Running tests in Firefox with geckodriver at {}", geckodriver + "Running tests in Firefox with geckodriver at {}", + geckodriver ); let test_runner = self @@ -412,7 +402,7 @@ impl Test { .display() .to_string(); let test_runner = test_runner.as_str(); - info!(log, "Using wasm-bindgen test runner at {}", test_runner); + info!("Using wasm-bindgen test runner at {}", test_runner); let mut envs = vec![ ("CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER", test_runner), @@ -422,11 +412,11 @@ impl Test { envs.push(("NO_HEADLESS", "1")); } - test::cargo_test_wasm(&self.crate_path, self.release, log, envs)?; + test::cargo_test_wasm(&self.crate_path, self.release, envs)?; Ok(()) } - fn step_get_safaridriver(&mut self, step: &Step, _log: &Logger) -> Result<(), failure::Error> { + fn step_get_safaridriver(&mut self, step: &Step) -> Result<(), failure::Error> { PBAR.step(step, "Getting safaridriver..."); assert!(self.safari && self.safaridriver.is_none()); @@ -434,14 +424,14 @@ impl Test { Ok(()) } - fn step_test_safari(&mut self, step: &Step, log: &Logger) -> Result<(), failure::Error> { + fn step_test_safari(&mut self, step: &Step) -> Result<(), failure::Error> { PBAR.step(step, "Running tests in Safari..."); let safaridriver = self.safaridriver.as_ref().unwrap().display().to_string(); let safaridriver = safaridriver.as_str(); info!( - log, - "Running tests in Safari with safaridriver at {}", safaridriver + "Running tests in Safari with safaridriver at {}", + safaridriver ); let test_runner = self @@ -451,7 +441,7 @@ impl Test { .display() .to_string(); let test_runner = test_runner.as_str(); - info!(log, "Using wasm-bindgen test runner at {}", test_runner); + info!("Using wasm-bindgen test runner at {}", test_runner); let mut envs = vec![ ("CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER", test_runner), @@ -461,7 +451,7 @@ impl Test { envs.push(("NO_HEADLESS", "1")); } - test::cargo_test_wasm(&self.crate_path, self.release, log, envs)?; + test::cargo_test_wasm(&self.crate_path, self.release, envs)?; Ok(()) } } diff --git a/src/lib.rs b/src/lib.rs index 702fafa44..13a572796 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,10 +20,7 @@ extern crate serde_json; extern crate siphasher; #[macro_use] extern crate structopt; -#[macro_use] -extern crate slog; -extern crate slog_async; -extern crate slog_term; +extern crate log; extern crate tar; extern crate toml; extern crate which; @@ -37,7 +34,6 @@ pub mod command; pub mod emoji; pub mod error; pub mod lockfile; -pub mod logger; pub mod manifest; pub mod npm; pub mod progressbar; diff --git a/src/logger.rs b/src/logger.rs deleted file mode 100644 index f8f6cc4cb..000000000 --- a/src/logger.rs +++ /dev/null @@ -1,72 +0,0 @@ -//! Logging facilities for `wasm-pack`. - -use command::Command; -use failure; -use slog::{Drain, Level, Logger}; -use slog_async::Async; -use slog_term::{FullFormat, PlainDecorator}; -use std::fs::OpenOptions; -use std::path::PathBuf; - -/// Create the logger for wasm-pack that will output any info warning or errors we encounter -pub fn new(cmd: &Command, verbosity: u8) -> Result { - let log_path = log_file_path(&cmd); - let file = OpenOptions::new() - .create(true) - .append(true) - .open(log_path)?; - - let decorator = PlainDecorator::new(file); - let drain = FullFormat::new(decorator).build().fuse(); - - // Set the log level based off the number of v passed in to the command line args. - // Level level means only messages of that level and higher are logged. If we have - // an error then we'll log it unconditionally, but extra levels are only available - // with extra v - let log_level = match verbosity { - 0 => Level::Error, - 1 => Level::Info, - 2 => Level::Debug, - _ => Level::Trace, - }; - let drain = Async::new(drain).build().filter_level(log_level).fuse(); - Ok(Logger::root(drain, o!())) -} - -/// Figure out where to stick the log based off the command arguments given -fn log_file_path(cmd: &Command) -> PathBuf { - let path = match cmd { - Command::Build(build_opts) => &build_opts.path, - Command::Pack { path } => path, - Command::Publish { path, access: _ } => path, - Command::Test(test_opts) => &test_opts.path, - Command::Login { .. } => &None, - }; - - // If the path exists attempt to use it, if not default to the current directory - if let Some(ref path) = path { - let mut path_buf = PathBuf::from(path); - path_buf.push("Cargo.toml"); - - // If the manifest file exists put the log in that directory otherwise default - // to the current directory. - if path_buf.exists() { - path_buf.pop(); - path_buf.push("wasm-pack.log"); - path_buf - } else { - let mut path_buf = this_dir(); - path_buf.push("wasm-pack.log"); - path_buf - } - } else { - let mut path_buf = this_dir(); - path_buf.push("wasm-pack.log"); - path_buf - } -} - -/// Return a `PathBuf` for the current directory -fn this_dir() -> PathBuf { - PathBuf::from(".") -} diff --git a/src/main.rs b/src/main.rs index 0af82966a..26698a28d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ extern crate atty; +extern crate env_logger; #[macro_use] extern crate failure; #[macro_use] @@ -9,11 +10,12 @@ extern crate which; use std::env; use structopt::StructOpt; -use wasm_pack::{command::run_wasm_pack, logger, Cli}; +use wasm_pack::{command::run_wasm_pack, Cli}; mod installer; fn main() { + env_logger::init(); setup_panic!(); if let Err(e) = run() { eprintln!("Error: {}", e); @@ -39,7 +41,6 @@ fn run() -> Result<(), failure::Error> { } let args = Cli::from_args(); - let log = logger::new(&args.cmd, args.verbosity)?; - run_wasm_pack(args.cmd, &log)?; + run_wasm_pack(args.cmd)?; Ok(()) } diff --git a/src/npm.rs b/src/npm.rs index 76fe84171..810f348e7 100644 --- a/src/npm.rs +++ b/src/npm.rs @@ -3,22 +3,21 @@ use child; use command::publish::access::Access; use failure::{self, ResultExt}; -use slog::Logger; use std::process::{Command, Stdio}; /// The default npm registry used when we aren't working with a custom registry. pub const DEFAULT_NPM_REGISTRY: &'static str = "https://registry.npmjs.org/"; /// Run the `npm pack` command. -pub fn npm_pack(log: &Logger, path: &str) -> Result<(), failure::Error> { +pub fn npm_pack(path: &str) -> Result<(), failure::Error> { let mut cmd = Command::new("npm"); cmd.current_dir(path).arg("pack"); - child::run(log, cmd, "npm pack").context("Packaging up your code failed")?; + child::run(cmd, "npm pack").context("Packaging up your code failed")?; Ok(()) } /// Run the `npm publish` command. -pub fn npm_publish(log: &Logger, path: &str, access: Option) -> Result<(), failure::Error> { +pub fn npm_publish(path: &str, access: Option) -> Result<(), failure::Error> { let mut cmd = Command::new("npm"); match access { Some(a) => cmd @@ -34,13 +33,12 @@ pub fn npm_publish(log: &Logger, path: &str, access: Option) -> Result<( .stdout(Stdio::inherit()), }; - child::run(log, cmd, "npm publish").context("Publishing to npm failed")?; + child::run(cmd, "npm publish").context("Publishing to npm failed")?; Ok(()) } /// Run the `npm login` command. pub fn npm_login( - log: &Logger, registry: &String, scope: &Option, always_auth: bool, @@ -67,7 +65,7 @@ pub fn npm_login( .arg(args) .stdin(Stdio::inherit()) .stdout(Stdio::inherit()); - child::run(log, cmd, "npm login") + child::run(cmd, "npm login") .with_context(|_| format!("Login to registry {} failed", registry))?; Ok(()) } diff --git a/src/test/mod.rs b/src/test/mod.rs index 1b71fed8a..0ec11e957 100644 --- a/src/test/mod.rs +++ b/src/test/mod.rs @@ -4,19 +4,14 @@ pub mod webdriver; use child; use failure::{self, ResultExt}; -use slog::Logger; +use log::info; use std::ffi::OsStr; use std::path::Path; use std::process::Command; /// Run `cargo test` with the `nightly` toolchain and targeting /// `wasm32-unknown-unknown`. -pub fn cargo_test_wasm( - path: &Path, - release: bool, - log: &Logger, - envs: I, -) -> Result<(), failure::Error> +pub fn cargo_test_wasm(path: &Path, release: bool, envs: I) -> Result<(), failure::Error> where I: IntoIterator, K: AsRef, @@ -30,12 +25,11 @@ where cmd.arg("--release"); } cmd.arg("--target").arg("wasm32-unknown-unknown"); - child::run(log, cmd, "cargo test") - .context("Running Wasm tests with wasm-bindgen-test failed")? + child::run(cmd, "cargo test").context("Running Wasm tests with wasm-bindgen-test failed")? }; for line in output.lines() { - info!(log, "test output: {}", line); + info!("test output: {}", line); println!("{}", line); } Ok(()) diff --git a/tests/all/main.rs b/tests/all/main.rs index 3fa272f30..ac67a03db 100644 --- a/tests/all/main.rs +++ b/tests/all/main.rs @@ -4,8 +4,6 @@ extern crate lazy_static; #[macro_use] extern crate serde_derive; extern crate serde_json; -#[macro_use] -extern crate slog; extern crate structopt; extern crate tempfile; extern crate wasm_pack; diff --git a/tests/all/utils/fixture.rs b/tests/all/utils/fixture.rs index be6484aad..8d3137686 100644 --- a/tests/all/utils/fixture.rs +++ b/tests/all/utils/fixture.rs @@ -1,4 +1,3 @@ -use super::logger::null_logger; use std::env; use std::fs; use std::mem::ManuallyDrop; @@ -132,7 +131,6 @@ impl Fixture { static INSTALL_WASM_BINDGEN: Once = ONCE_INIT; let cache = self.cache(); let version = "0.2.21"; - let log = &null_logger(); let download = || { if let Ok(download) = @@ -141,7 +139,7 @@ impl Fixture { return Ok(download); } - wasm_pack::bindgen::cargo_install_wasm_bindgen(log, &cache, version, true) + wasm_pack::bindgen::cargo_install_wasm_bindgen(&cache, version, true) }; // Only one thread can perform the actual download, and then afterwards @@ -205,18 +203,17 @@ impl Fixture { } pub fn run(&self, cmd: wasm_pack::command::Command) -> Result<(), failure::Error> { - let logger = wasm_pack::logger::new(&cmd, 3)?; match cmd { wasm_pack::command::Command::Test(cmd) => { let _lock = self.lock(); let mut test = wasm_pack::command::test::Test::try_from_opts(cmd)?; test.set_cache(self.cache()); - test.run(&logger) + test.run() } wasm_pack::command::Command::Build(cmd) => { let mut build = wasm_pack::command::build::Build::try_from_opts(cmd)?; build.set_cache(self.cache()); - build.run(&logger) + build.run() } _ => unreachable!(), } diff --git a/tests/all/utils/logger.rs b/tests/all/utils/logger.rs deleted file mode 100644 index 46cc0d7e4..000000000 --- a/tests/all/utils/logger.rs +++ /dev/null @@ -1,6 +0,0 @@ -use slog::Logger; - -// Create a logger that ignores log messages for testing. -pub fn null_logger() -> Logger { - Logger::root(slog::Discard, o!()) -} diff --git a/tests/all/utils/mod.rs b/tests/all/utils/mod.rs index 655b80d81..8b4244fa1 100644 --- a/tests/all/utils/mod.rs +++ b/tests/all/utils/mod.rs @@ -1,4 +1,3 @@ pub mod file; pub mod fixture; -pub mod logger; pub mod manifest;