mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1441204 - Upgrade log crate from 0.4.1 to 0.4.2. r=maja_zf
MozReview-Commit-ID: FMIeUf55uzU --HG-- extra : rebase_source : d9aa60055cbb1bb313e0c695ad08599af25b155a
This commit is contained in:
parent
d7d1dbd6fa
commit
d167d54ea0
46
Cargo.lock
generated
46
Cargo.lock
generated
@ -177,7 +177,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"Inflector 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webidl 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -189,7 +189,7 @@ dependencies = [
|
||||
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webidl 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -657,7 +657,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"atty 0.2.2 (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.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -786,7 +786,7 @@ dependencies = [
|
||||
"clap 2.31.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozprofile 0.3.0",
|
||||
"mozrunner 0.6.1",
|
||||
"mozversion 0.1.3",
|
||||
@ -805,7 +805,7 @@ dependencies = [
|
||||
"cssparser 0.23.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
"nsstring 0.1.0",
|
||||
"parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -847,7 +847,7 @@ dependencies = [
|
||||
"encoding_glue 0.1.0",
|
||||
"env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"geckoservo 0.0.1",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozurl 0.0.1",
|
||||
"mp4parse_capi 0.10.1",
|
||||
"netwerk_helper 0.0.1",
|
||||
@ -866,7 +866,7 @@ version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -981,7 +981,7 @@ dependencies = [
|
||||
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozjs_sys 0.0.0",
|
||||
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -1122,12 +1122,12 @@ name = "log"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1283,7 +1283,7 @@ dependencies = [
|
||||
name = "mozrunner"
|
||||
version = "0.6.1"
|
||||
dependencies = [
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozprofile 0.3.0",
|
||||
"winreg 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -1313,7 +1313,7 @@ version = "0.10.1"
|
||||
dependencies = [
|
||||
"bitreader 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mp4parse_fallible 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -1327,7 +1327,7 @@ name = "mp4parse_capi"
|
||||
version = "0.10.1"
|
||||
dependencies = [
|
||||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mp4parse 0.10.1",
|
||||
"num-traits 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -1570,7 +1570,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@ -1754,7 +1754,7 @@ name = "rust-ini"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1792,7 +1792,7 @@ dependencies = [
|
||||
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.23.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"phf_codegen 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1942,7 +1942,7 @@ dependencies = [
|
||||
"itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
"malloc_size_of_derive 0.0.1",
|
||||
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2007,7 +2007,7 @@ dependencies = [
|
||||
"euclid 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"geckoservo 0.0.1",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
"regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"selectors 0.19.0",
|
||||
@ -2187,7 +2187,7 @@ dependencies = [
|
||||
"devd-rs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libudev 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"runloop 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2309,7 +2309,7 @@ version = "0.35.1"
|
||||
dependencies = [
|
||||
"cookie 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.10.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2344,7 +2344,7 @@ dependencies = [
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plane-split 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2387,7 +2387,7 @@ dependencies = [
|
||||
"foreign-types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"nsstring 0.1.0",
|
||||
"rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_profiler 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2625,7 +2625,7 @@ dependencies = [
|
||||
"checksum libz-sys 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)" = "3fdd64ef8ee652185674455c1d450b83cbc8ad895625d543b5324d923f82e4d8"
|
||||
"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e"
|
||||
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
|
||||
"checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"
|
||||
"checksum log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6fddaa003a65722a7fb9e26b0ce95921fe4ba590542ced664d8ce2fa26f9f3ac"
|
||||
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
|
||||
"checksum memchr 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "148fab2e51b4f1cfc66da2a7c32981d1d3c083a803978268bb11fe4b86925e7a"
|
||||
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
|
||||
|
2
third_party/rust/log/.cargo-checksum.json
vendored
2
third_party/rust/log/.cargo-checksum.json
vendored
@ -1 +1 @@
|
||||
{"files":{".travis.yml":"8e95f3543ff36e1fd0e2e2fcc98b31e20dcc19d220f3d7d19bfb9aeb61030823","CHANGELOG.md":"cdfe104547fca9d80b95cff2c6ef5af7cdcd0a17886ec3722c157a598abec018","Cargo.toml":"ba13b382a64b910241ce4fc2ac4f45dd3a8f404f762f07958004a41de1cb55df","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"95873097578066ef6a0cc395f1aad5596762570ba1476757643fb319e3892481","appveyor.yml":"d5376a881aef6dc3bed6a6b51f1f1c3801b88fc77a12895f6953190256e965bc","src/lib.rs":"4ffa677655636a6c111026d318c92bb53bd91988e601fcdcdbe1f43b1997b8fd","src/macros.rs":"064c96e154b58b61b8a4f11cab9c0664dd171010f578af438fad0dc1d796ac5c","src/serde.rs":"7617ffa21dde363a06389f8e26661f35550c1a01ff142f81275e95f42b79c854","tests/filters.rs":"6aee024d4594b4fde772e35c5d3318e5aa5d9aa4eaeafb04e4c7c922be4ac837"},"package":"89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"}
|
||||
{"files":{".travis.yml":"8e95f3543ff36e1fd0e2e2fcc98b31e20dcc19d220f3d7d19bfb9aeb61030823","CHANGELOG.md":"be517021ee88b47fcf34646e3f1797d04716f6ec89456aefad91f5827fdf46de","Cargo.toml":"f024400f35949bfb0c40fde1aad0ec92110fbac3232a5440d619413b29d4af08","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"6485b8ed310d3f0340bf1ad1f47645069ce4069dcc6bb46c7d5c6faf41de1fdb","README.md":"07f2741a5bb74a952fe8fac006285649a65d737c358504e9337a158d84d2b38f","appveyor.yml":"d5376a881aef6dc3bed6a6b51f1f1c3801b88fc77a12895f6953190256e965bc","src/lib.rs":"ef06fbd35cd13ba193cb8d5cc1999a24b30c1ead90a30a969cccc00989eb8bb9","src/macros.rs":"80191f9d62ea3e04738ce5353851d1b26b9b190342191f678745eccf3ff7e6fe","src/serde.rs":"a5ae50d6f5ac538a5ca57ee58031a2582afa6989c741574584756632a4131ba7","tests/filters.rs":"6aee024d4594b4fde772e35c5d3318e5aa5d9aa4eaeafb04e4c7c922be4ac837"},"package":"6fddaa003a65722a7fb9e26b0ce95921fe4ba590542ced664d8ce2fa26f9f3ac"}
|
13
third_party/rust/log/CHANGELOG.md
vendored
13
third_party/rust/log/CHANGELOG.md
vendored
@ -2,6 +2,16 @@
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.4.2] - 2018-06-05
|
||||
|
||||
### Improved
|
||||
|
||||
* Log invocations now generate less code.
|
||||
|
||||
### Fixed
|
||||
|
||||
* Example Logger implementations now properly set the max log level.
|
||||
|
||||
## [0.4.1] - 2017-12-30
|
||||
|
||||
### Fixed
|
||||
@ -77,7 +87,8 @@ version using log 0.4.x to avoid losing module and file information.
|
||||
|
||||
Look at the [release tags] for information about older releases.
|
||||
|
||||
[Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.1...HEAD
|
||||
[Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.2...HEAD
|
||||
[0.4.2]: https://github.com/rust-lang-nursery/log/compare/0.4.1...0.4.2
|
||||
[0.4.1]: https://github.com/rust-lang-nursery/log/compare/0.4.0...0.4.1
|
||||
[0.4.0]: https://github.com/rust-lang-nursery/log/compare/0.3.8...0.4.0
|
||||
[release tags]: https://github.com/rust-lang-nursery/log/releases
|
||||
|
2
third_party/rust/log/Cargo.toml
vendored
2
third_party/rust/log/Cargo.toml
vendored
@ -12,7 +12,7 @@
|
||||
|
||||
[package]
|
||||
name = "log"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
authors = ["The Rust Project Developers"]
|
||||
description = "A lightweight logging facade for Rust\n"
|
||||
homepage = "https://github.com/rust-lang/log"
|
||||
|
3
third_party/rust/log/README.md
vendored
3
third_party/rust/log/README.md
vendored
@ -29,7 +29,7 @@ log = "0.4"
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
pub fn shave_the_yak(yak: &Yak) {
|
||||
pub fn shave_the_yak(yak: &mut Yak) {
|
||||
trace!("Commencing yak shaving");
|
||||
|
||||
loop {
|
||||
@ -65,6 +65,7 @@ There are many available implementations to chose from, here are some of the mos
|
||||
* Adaptors for other facilities:
|
||||
* [`syslog`](https://docs.rs/syslog/*/syslog/)
|
||||
* [`slog-stdlog`](https://docs.rs/slog-stdlog/*/slog_stdlog/)
|
||||
* [`android_log`](https://docs.rs/android_log/*/android_log/)
|
||||
|
||||
Executables should choose a logger implementation and initialize it early in the
|
||||
runtime of the program. Logger implementations will typically include a
|
||||
|
119
third_party/rust/log/src/lib.rs
vendored
119
third_party/rust/log/src/lib.rs
vendored
@ -53,9 +53,9 @@
|
||||
//! extern crate log;
|
||||
//!
|
||||
//! # #[derive(Debug)] pub struct Yak(String);
|
||||
//! # impl Yak { fn shave(&self, _: u32) {} }
|
||||
//! # impl Yak { fn shave(&mut self, _: u32) {} }
|
||||
//! # fn find_a_razor() -> Result<u32, u32> { Ok(1) }
|
||||
//! pub fn shave_the_yak(yak: &Yak) {
|
||||
//! pub fn shave_the_yak(yak: &mut Yak) {
|
||||
//! info!(target: "yak_events", "Commencing yak shaving for {:?}", yak);
|
||||
//!
|
||||
//! loop {
|
||||
@ -138,16 +138,16 @@
|
||||
//! # fn main() {}
|
||||
//! ```
|
||||
//!
|
||||
//! Loggers are installed by calling the [`set_logger`] function. It takes a
|
||||
//! closure which is provided a [`MaxLevelFilter`] token and returns a
|
||||
//! [`Log`] trait object. The [`MaxLevelFilter`] token controls the global
|
||||
//! maximum log level. The logging facade uses this as an optimization to
|
||||
//! improve performance of log messages at levels that are disabled. In the
|
||||
//! case of our example logger, we'll want to set the maximum log level to
|
||||
//! [`Info`][level_link], since we ignore any [`Debug`][level_link] or
|
||||
//! [`Trace`][level_link] level log messages. A logging implementation
|
||||
//! should provide a function that wraps a call to [`set_logger`], handling
|
||||
//! initialization of the logger:
|
||||
//! Loggers are installed by calling the [`set_logger`] function. The maximum
|
||||
//! log level also needs to be adjusted via the [`set_max_level`] function. The
|
||||
//! logging facade uses this as an optimization to improve performance of log
|
||||
//! messages at levels that are disabled. It's important to set it, as it
|
||||
//! defaults to [`Off`][filter_link], so no log messages will ever be captured!
|
||||
//! In the case of our example logger, we'll want to set the maximum log level
|
||||
//! to [`Info`][filter_link], since we ignore any [`Debug`][level_link] or
|
||||
//! [`Trace`][level_link] level log messages. A logging implementation should
|
||||
//! provide a function that wraps a call to [`set_logger`] and
|
||||
//! [`set_max_level`], handling initialization of the logger:
|
||||
//!
|
||||
//! ```rust
|
||||
//! # extern crate log;
|
||||
@ -165,16 +165,20 @@
|
||||
//!
|
||||
//! pub fn init() -> Result<(), SetLoggerError> {
|
||||
//! log::set_logger(&LOGGER)
|
||||
//! .map(|()| log::set_max_level(LevelFilter::Info))
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! Implementations that adjust their configurations at runtime should take care
|
||||
//! to adjust the maximum log level as well.
|
||||
//!
|
||||
//! # Use with `std`
|
||||
//!
|
||||
//! `set_logger` requires you to provide a `&'static Log`, which can be hard if
|
||||
//! your logger depends on some runtime configuration. The `set_boxed_logger`
|
||||
//! function is available with the `std` Cargo feature. It is identical to
|
||||
//! `set_logger` except that it requires you to provide a `Box<Log>` rather than
|
||||
//! a `&'static Log`:
|
||||
//! `set_logger` requires you to provide a `&'static Log`, which can be hard to
|
||||
//! obtain if your logger depends on some runtime configuration. The
|
||||
//! `set_boxed_logger` function is available with the `std` Cargo feature. It is
|
||||
//! identical to `set_logger` except that it takes a `Box<Log>` rather than a
|
||||
//! `&'static Log`:
|
||||
//!
|
||||
//! ```rust
|
||||
//! # extern crate log;
|
||||
@ -189,6 +193,7 @@
|
||||
//! # #[cfg(feature = "std")]
|
||||
//! pub fn init() -> Result<(), SetLoggerError> {
|
||||
//! log::set_boxed_logger(Box::new(SimpleLogger))
|
||||
//! .map(|()| log::set_max_level(LevelFilter::Info))
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
@ -222,6 +227,19 @@
|
||||
//! [dependencies]
|
||||
//! log = { version = "0.4", features = ["max_level_debug", "release_max_level_warn"] }
|
||||
//! ```
|
||||
//! # Crate Feature Flags
|
||||
//!
|
||||
//! The following crate feature flags are avaliable in addition to the filters. They are
|
||||
//! configured in your `Cargo.toml`.
|
||||
//!
|
||||
//! * `std` allows use of `std` crate instead of the default `core`. Enables using `std::error` and
|
||||
//! `set_boxed_logger` functionality.
|
||||
//! * `serde` enables support for serialization and deserialization of `Level` and `LevelFilter`.
|
||||
//!
|
||||
//! ```toml
|
||||
//! [dependencies]
|
||||
//! log = { version = "0.4", features = ["std", "serde"] }
|
||||
//! ```
|
||||
//!
|
||||
//! # Version compatibility
|
||||
//!
|
||||
@ -232,8 +250,9 @@
|
||||
//!
|
||||
//! [`Log`]: trait.Log.html
|
||||
//! [level_link]: enum.Level.html
|
||||
//! [filter_link]: enum.LevelFilter.html
|
||||
//! [`set_logger`]: fn.set_logger.html
|
||||
//! [`MaxLevelFilter`]: struct.MaxLevelFilter.html
|
||||
//! [`set_max_level`]: fn.set_max_level.html
|
||||
//! [`try_set_logger_raw`]: fn.try_set_logger_raw.html
|
||||
//! [`shutdown_logger_raw`]: fn.shutdown_logger_raw.html
|
||||
//! [env_logger]: https://docs.rs/env_logger/*/env_logger/
|
||||
@ -247,14 +266,14 @@
|
||||
//! [log4rs]: https://docs.rs/log4rs/*/log4rs/
|
||||
//! [fern]: https://docs.rs/fern/*/fern/
|
||||
|
||||
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://docs.rs/log/0.4.1")]
|
||||
#![doc(
|
||||
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "https://www.rust-lang.org/favicon.ico",
|
||||
html_root_url = "https://docs.rs/log/0.4"
|
||||
)]
|
||||
#![warn(missing_docs)]
|
||||
#![deny(missing_debug_implementations)]
|
||||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
|
||||
// When compiled for the rustc compiler itself we want to make sure that this is
|
||||
// an unstable crate
|
||||
#![cfg_attr(rustbuild, feature(staged_api, rustc_private))]
|
||||
@ -272,7 +291,7 @@ use std::error;
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
use std::str::FromStr;
|
||||
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
|
||||
|
||||
#[macro_use]
|
||||
mod macros;
|
||||
@ -294,10 +313,10 @@ static MAX_LOG_LEVEL_FILTER: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||
|
||||
static LOG_LEVEL_NAMES: [&'static str; 6] = ["OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"];
|
||||
|
||||
static SET_LOGGER_ERROR: &'static str = "attempted to set a logger after the logging system was \
|
||||
already initialized";
|
||||
static LEVEL_PARSE_ERROR: &'static str = "attempted to convert a string that doesn't match an \
|
||||
existing log level";
|
||||
static SET_LOGGER_ERROR: &'static str = "attempted to set a logger after the logging system \
|
||||
was already initialized";
|
||||
static LEVEL_PARSE_ERROR: &'static str =
|
||||
"attempted to convert a string that doesn't match an existing log level";
|
||||
|
||||
/// An enum representing the available verbosity levels of the logger.
|
||||
///
|
||||
@ -390,9 +409,9 @@ fn eq_ignore_ascii_case(a: &str, b: &str) -> bool {
|
||||
}
|
||||
|
||||
if a.len() == b.len() {
|
||||
a.bytes().zip(b.bytes()).all(|(a, b)| {
|
||||
to_ascii_uppercase(a) == to_ascii_uppercase(b)
|
||||
})
|
||||
a.bytes()
|
||||
.zip(b.bytes())
|
||||
.all(|(a, b)| to_ascii_uppercase(a) == to_ascii_uppercase(b))
|
||||
} else {
|
||||
false
|
||||
}
|
||||
@ -1048,7 +1067,7 @@ pub fn set_logger(logger: &'static Log) -> Result<(), SetLoggerError> {
|
||||
|
||||
fn set_logger_inner<F>(make_logger: F) -> Result<(), SetLoggerError>
|
||||
where
|
||||
F: FnOnce() -> &'static Log
|
||||
F: FnOnce() -> &'static Log,
|
||||
{
|
||||
unsafe {
|
||||
if STATE.compare_and_swap(UNINITIALIZED, INITIALIZING, Ordering::SeqCst) != UNINITIALIZED {
|
||||
@ -1117,6 +1136,34 @@ pub fn logger() -> &'static Log {
|
||||
}
|
||||
}
|
||||
|
||||
// WARNING: this is not part of the crate's public API and is subject to change at any time
|
||||
#[doc(hidden)]
|
||||
pub fn __private_api_log(
|
||||
args: fmt::Arguments,
|
||||
level: Level,
|
||||
target: &str,
|
||||
module_path: &str,
|
||||
file: &str,
|
||||
line: u32,
|
||||
) {
|
||||
logger().log(
|
||||
&Record::builder()
|
||||
.args(args)
|
||||
.level(level)
|
||||
.target(target)
|
||||
.module_path(Some(module_path))
|
||||
.file(Some(file))
|
||||
.line(Some(line))
|
||||
.build(),
|
||||
);
|
||||
}
|
||||
|
||||
// WARNING: this is not part of the crate's public API and is subject to change at any time
|
||||
#[doc(hidden)]
|
||||
pub fn __private_api_enabled(level: Level, target: &str) -> bool {
|
||||
logger().enabled(&Metadata::builder().level(level).target(target).build())
|
||||
}
|
||||
|
||||
/// The statically resolved maximum log level.
|
||||
///
|
||||
/// See the crate level documentation for information on how to configure this.
|
||||
@ -1159,8 +1206,8 @@ cfg_if! {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
extern crate std;
|
||||
use tests::std::string::ToString;
|
||||
use super::{Level, LevelFilter, ParseLevelError};
|
||||
use tests::std::string::ToString;
|
||||
|
||||
#[test]
|
||||
fn test_levelfilter_from_str() {
|
||||
@ -1247,13 +1294,13 @@ mod tests {
|
||||
#[test]
|
||||
#[cfg(feature = "std")]
|
||||
fn test_error_trait() {
|
||||
use std::error::Error;
|
||||
use super::SetLoggerError;
|
||||
use std::error::Error;
|
||||
let e = SetLoggerError(());
|
||||
assert_eq!(
|
||||
e.description(),
|
||||
"attempted to set a logger after the logging system \
|
||||
was already initialized"
|
||||
was already initialized"
|
||||
);
|
||||
}
|
||||
|
||||
@ -1321,7 +1368,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_record_complete_builder() {
|
||||
use super::{Record, Level};
|
||||
use super::{Level, Record};
|
||||
let target = "myApp";
|
||||
let record_test = Record::builder()
|
||||
.module_path(Some("foo"))
|
||||
|
38
third_party/rust/log/src/macros.rs
vendored
38
third_party/rust/log/src/macros.rs
vendored
@ -34,17 +34,14 @@ macro_rules! log {
|
||||
(target: $target:expr, $lvl:expr, $($arg:tt)+) => ({
|
||||
let lvl = $lvl;
|
||||
if lvl <= $crate::STATIC_MAX_LEVEL && lvl <= $crate::max_level() {
|
||||
$crate::Log::log(
|
||||
$crate::logger(),
|
||||
&$crate::RecordBuilder::new()
|
||||
.args(format_args!($($arg)+))
|
||||
.level(lvl)
|
||||
.target($target)
|
||||
.module_path(Some(module_path!()))
|
||||
.file(Some(file!()))
|
||||
.line(Some(line!()))
|
||||
.build()
|
||||
)
|
||||
$crate::__private_api_log(
|
||||
format_args!($($arg)+),
|
||||
lvl,
|
||||
$target,
|
||||
module_path!(),
|
||||
file!(),
|
||||
line!(),
|
||||
);
|
||||
}
|
||||
});
|
||||
($lvl:expr, $($arg:tt)+) => (log!(target: module_path!(), $lvl, $($arg)+))
|
||||
@ -205,16 +202,13 @@ macro_rules! trace {
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! log_enabled {
|
||||
(target: $target:expr, $lvl:expr) => ({
|
||||
(target: $target:expr, $lvl:expr) => {{
|
||||
let lvl = $lvl;
|
||||
lvl <= $crate::STATIC_MAX_LEVEL && lvl <= $crate::max_level() &&
|
||||
$crate::Log::enabled(
|
||||
$crate::logger(),
|
||||
&$crate::MetadataBuilder::new()
|
||||
.level(lvl)
|
||||
.target($target)
|
||||
.build(),
|
||||
)
|
||||
});
|
||||
($lvl:expr) => (log_enabled!(target: module_path!(), $lvl))
|
||||
lvl <= $crate::STATIC_MAX_LEVEL
|
||||
&& lvl <= $crate::max_level()
|
||||
&& $crate::__private_api_enabled(lvl, $target)
|
||||
}};
|
||||
($lvl:expr) => {
|
||||
log_enabled!(target: module_path!(), $lvl)
|
||||
};
|
||||
}
|
||||
|
75
third_party/rust/log/src/serde.rs
vendored
75
third_party/rust/log/src/serde.rs
vendored
@ -3,12 +3,12 @@
|
||||
extern crate serde;
|
||||
use self::serde::ser::{Serialize, Serializer};
|
||||
use self::serde::de::{Deserialize, DeserializeSeed, Deserializer, Visitor, EnumAccess,
|
||||
VariantAccess, Error};
|
||||
Unexpected, VariantAccess, Error};
|
||||
|
||||
use {Level, LevelFilter, LOG_LEVEL_NAMES};
|
||||
|
||||
use std::fmt;
|
||||
use std::str::FromStr;
|
||||
use std::str::{self, FromStr};
|
||||
|
||||
// The Deserialize impls are handwritten to be case insensitive using FromStr.
|
||||
|
||||
@ -48,6 +48,16 @@ impl<'de> Deserialize<'de> for Level {
|
||||
// Case insensitive.
|
||||
FromStr::from_str(s).map_err(|_| Error::unknown_variant(s, &LOG_LEVEL_NAMES[1..]))
|
||||
}
|
||||
|
||||
fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E>
|
||||
where
|
||||
E: Error,
|
||||
{
|
||||
let variant = str::from_utf8(value)
|
||||
.map_err(|_| Error::invalid_value(Unexpected::Bytes(value), &self))?;
|
||||
|
||||
self.visit_str(variant)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> DeserializeSeed<'de> for LevelIdentifier {
|
||||
@ -122,6 +132,16 @@ impl<'de> Deserialize<'de> for LevelFilter {
|
||||
// Case insensitive.
|
||||
FromStr::from_str(s).map_err(|_| Error::unknown_variant(s, &LOG_LEVEL_NAMES))
|
||||
}
|
||||
|
||||
fn visit_bytes<E>(self, value: &[u8]) -> Result<Self::Value, E>
|
||||
where
|
||||
E: Error,
|
||||
{
|
||||
let variant = str::from_utf8(value)
|
||||
.map_err(|_| Error::invalid_value(Unexpected::Bytes(value), &self))?;
|
||||
|
||||
self.visit_str(variant)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> DeserializeSeed<'de> for LevelFilterIdentifier {
|
||||
@ -162,7 +182,7 @@ impl<'de> Deserialize<'de> for LevelFilter {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
extern crate serde_test;
|
||||
use self::serde_test::{Token, assert_tokens, assert_de_tokens, assert_de_tokens_error};
|
||||
use self::serde_test::{assert_de_tokens, assert_de_tokens_error, assert_tokens, Token};
|
||||
|
||||
use {Level, LevelFilter};
|
||||
|
||||
@ -173,6 +193,14 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
fn level_bytes_tokens(variant: &'static [u8]) -> [Token; 3] {
|
||||
[
|
||||
Token::Enum { name: "Level" },
|
||||
Token::Bytes(variant),
|
||||
Token::Unit,
|
||||
]
|
||||
}
|
||||
|
||||
fn level_filter_token(variant: &'static str) -> Token {
|
||||
Token::UnitVariant {
|
||||
name: "LevelFilter",
|
||||
@ -180,6 +208,16 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
fn level_filter_bytes_tokens(variant: &'static [u8]) -> [Token; 3] {
|
||||
[
|
||||
Token::Enum {
|
||||
name: "LevelFilter",
|
||||
},
|
||||
Token::Bytes(variant),
|
||||
Token::Unit,
|
||||
]
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_level_ser_de() {
|
||||
let cases = [
|
||||
@ -210,6 +248,21 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_level_de_bytes() {
|
||||
let cases = [
|
||||
(Level::Error, level_bytes_tokens(b"ERROR")),
|
||||
(Level::Warn, level_bytes_tokens(b"WARN")),
|
||||
(Level::Info, level_bytes_tokens(b"INFO")),
|
||||
(Level::Debug, level_bytes_tokens(b"DEBUG")),
|
||||
(Level::Trace, level_bytes_tokens(b"TRACE")),
|
||||
];
|
||||
|
||||
for &(value, tokens) in &cases {
|
||||
assert_de_tokens(&value, &tokens);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_level_de_error() {
|
||||
let msg = "unknown variant `errorx`, expected one of \
|
||||
@ -249,6 +302,22 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_level_filter_de_bytes() {
|
||||
let cases = [
|
||||
(LevelFilter::Off, level_filter_bytes_tokens(b"OFF")),
|
||||
(LevelFilter::Error, level_filter_bytes_tokens(b"ERROR")),
|
||||
(LevelFilter::Warn, level_filter_bytes_tokens(b"WARN")),
|
||||
(LevelFilter::Info, level_filter_bytes_tokens(b"INFO")),
|
||||
(LevelFilter::Debug, level_filter_bytes_tokens(b"DEBUG")),
|
||||
(LevelFilter::Trace, level_filter_bytes_tokens(b"TRACE")),
|
||||
];
|
||||
|
||||
for &(value, tokens) in &cases {
|
||||
assert_de_tokens(&value, &tokens);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_level_filter_de_error() {
|
||||
let msg = "unknown variant `errorx`, expected one of \
|
||||
|
Loading…
Reference in New Issue
Block a user