Revert move from chrono to local-time

This reverts commit 9e85637419
This commit is contained in:
binarybaron 2021-12-27 15:29:13 +01:00
parent 3ce4dffb84
commit 43c07636d8
6 changed files with 19 additions and 50 deletions

View File

@ -16,7 +16,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
This is a breaking database change! This is a breaking database change!
Swaps that were saved prior to this change may fail to load if they are in state `SwapSetupCompleted` of `BtcLocked`. Swaps that were saved prior to this change may fail to load if they are in state `SwapSetupCompleted` of `BtcLocked`.
Make sure to finish your swaps before upgrading. Make sure to finish your swaps before upgrading.
- logs to use rfc3339 local time formatting.
## [0.10.1] - 2021-12-23 ## [0.10.1] - 2021-12-23

44
Cargo.lock generated
View File

@ -2124,15 +2124,6 @@ dependencies = [
"regex-automata", "regex-automata",
] ]
[[package]]
name = "matchers"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
dependencies = [
"regex-automata",
]
[[package]] [[package]]
name = "matches" name = "matches"
version = "0.1.8" version = "0.1.8"
@ -2246,7 +2237,7 @@ dependencies = [
"testcontainers 0.12.0", "testcontainers 0.12.0",
"tokio", "tokio",
"tracing", "tracing",
"tracing-subscriber 0.2.25", "tracing-subscriber",
] ]
[[package]] [[package]]
@ -2280,7 +2271,7 @@ dependencies = [
"rand 0.7.3", "rand 0.7.3",
"testcontainers 0.12.0", "testcontainers 0.12.0",
"tokio", "tokio",
"tracing-subscriber 0.2.25", "tracing-subscriber",
] ]
[[package]] [[package]]
@ -4029,7 +4020,7 @@ dependencies = [
"tracing", "tracing",
"tracing-appender", "tracing-appender",
"tracing-futures", "tracing-futures",
"tracing-subscriber 0.3.3", "tracing-subscriber",
"url", "url",
"uuid", "uuid",
"vergen", "vergen",
@ -4169,7 +4160,6 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cde1cf55178e0293453ba2cca0d5f8392a922e52aa958aee9c28ed02becc6d03" checksum = "cde1cf55178e0293453ba2cca0d5f8392a922e52aa958aee9c28ed02becc6d03"
dependencies = [ dependencies = [
"itoa",
"libc", "libc",
] ]
@ -4366,13 +4356,13 @@ dependencies = [
[[package]] [[package]]
name = "tracing-appender" name = "tracing-appender"
version = "0.2.0" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94571df2eae3ed4353815ea5a90974a594a1792d8782ff2cbcc9392d1101f366" checksum = "9965507e507f12c8901432a33e31131222abac31edd90cabbcf85cf544b7127a"
dependencies = [ dependencies = [
"chrono",
"crossbeam-channel", "crossbeam-channel",
"time 0.3.3", "tracing-subscriber",
"tracing-subscriber 0.3.3",
] ]
[[package]] [[package]]
@ -4437,30 +4427,12 @@ dependencies = [
"ansi_term 0.12.1", "ansi_term 0.12.1",
"chrono", "chrono",
"lazy_static", "lazy_static",
"matchers 0.0.1", "matchers",
"regex",
"sharded-slab",
"thread_local",
"tracing",
"tracing-core",
"tracing-log",
]
[[package]]
name = "tracing-subscriber"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "245da694cc7fc4729f3f418b304cb57789f1bed2a78c575407ab8a23f53cb4d3"
dependencies = [
"ansi_term 0.12.1",
"lazy_static",
"matchers 0.1.0",
"regex", "regex",
"serde", "serde",
"serde_json", "serde_json",
"sharded-slab", "sharded-slab",
"thread_local", "thread_local",
"time 0.3.3",
"tracing", "tracing",
"tracing-core", "tracing-core",
"tracing-log", "tracing-log",

View File

@ -60,9 +60,9 @@ tokio-util = { version = "0.6", features = [ "io" ] }
toml = "0.5" toml = "0.5"
torut = { version = "0.2", default-features = false, features = [ "v3", "control" ] } torut = { version = "0.2", default-features = false, features = [ "v3", "control" ] }
tracing = { version = "0.1", features = [ "attributes" ] } tracing = { version = "0.1", features = [ "attributes" ] }
tracing-appender = "0.2" tracing-appender = "0.1"
tracing-futures = { version = "0.2", features = [ "std-future", "futures-03" ] } tracing-futures = { version = "0.2", features = [ "std-future", "futures-03" ] }
tracing-subscriber = { version = "0.3", default-features = false, features = [ "fmt", "ansi", "env-filter", "local-time", "tracing-log", "json" ] } tracing-subscriber = { version = "0.2", default-features = false, features = [ "fmt", "ansi", "env-filter", "chrono", "tracing-log", "json" ] }
url = { version = "2", features = [ "serde" ] } url = { version = "2", features = [ "serde" ] }
uuid = { version = "0.8", features = [ "serde", "v4" ] } uuid = { version = "0.8", features = [ "serde", "v4" ] }
void = "1" void = "1"

View File

@ -1,7 +1,6 @@
use anyhow::Result; use anyhow::Result;
use time::format_description::well_known::Rfc3339;
use tracing_subscriber::filter::LevelFilter; use tracing_subscriber::filter::LevelFilter;
use tracing_subscriber::fmt::time::LocalTime; use tracing_subscriber::fmt::time::ChronoLocal;
use tracing_subscriber::FmtSubscriber; use tracing_subscriber::FmtSubscriber;
pub fn init(level: LevelFilter, json_format: bool, timestamp: bool) -> Result<()> { pub fn init(level: LevelFilter, json_format: bool, timestamp: bool) -> Result<()> {
@ -15,7 +14,7 @@ pub fn init(level: LevelFilter, json_format: bool, timestamp: bool) -> Result<()
.with_env_filter(format!("asb={},swap={}", level, level)) .with_env_filter(format!("asb={},swap={}", level, level))
.with_writer(std::io::stderr) .with_writer(std::io::stderr)
.with_ansi(is_terminal) .with_ansi(is_terminal)
.with_timer(LocalTime::new(Rfc3339)) .with_timer(ChronoLocal::with_format("%F %T".to_owned()))
.with_target(false); .with_target(false);
match (json_format, timestamp) { match (json_format, timestamp) {

View File

@ -1,11 +1,10 @@
use anyhow::Result; use anyhow::Result;
use std::option::Option::Some; use std::option::Option::Some;
use std::path::Path; use std::path::Path;
use time::format_description::well_known::Rfc3339;
use tracing::subscriber::set_global_default; use tracing::subscriber::set_global_default;
use tracing::{Event, Level, Subscriber}; use tracing::{Event, Level, Subscriber};
use tracing_subscriber::fmt::format::{DefaultFields, Format, JsonFields}; use tracing_subscriber::fmt::format::{DefaultFields, Format, JsonFields};
use tracing_subscriber::fmt::time::LocalTime; use tracing_subscriber::fmt::time::ChronoLocal;
use tracing_subscriber::layer::{Context, SubscriberExt}; use tracing_subscriber::layer::{Context, SubscriberExt};
use tracing_subscriber::{fmt, EnvFilter, FmtSubscriber, Layer, Registry}; use tracing_subscriber::{fmt, EnvFilter, FmtSubscriber, Layer, Registry};
use uuid::Uuid; use uuid::Uuid;
@ -53,7 +52,7 @@ pub fn init(debug: bool, json: bool, dir: impl AsRef<Path>, swap_id: Option<Uuid
.with_env_filter(format!("swap={}", level)) .with_env_filter(format!("swap={}", level))
.with_writer(std::io::stderr) .with_writer(std::io::stderr)
.with_ansi(is_terminal) .with_ansi(is_terminal)
.with_timer(LocalTime::new(Rfc3339)) .with_timer(ChronoLocal::with_format("%F %T".to_owned()))
.with_target(false); .with_target(false);
if json { if json {
@ -85,25 +84,25 @@ type StdErrJsonLayer<S, T> = tracing_subscriber::fmt::Layer<
fn() -> std::io::Stderr, fn() -> std::io::Stderr,
>; >;
fn debug_terminal_printer<S>() -> StdErrPrinter<StdErrLayer<S, LocalTime<Rfc3339>>> { fn debug_terminal_printer<S>() -> StdErrPrinter<StdErrLayer<S, ChronoLocal>> {
let is_terminal = atty::is(atty::Stream::Stderr); let is_terminal = atty::is(atty::Stream::Stderr);
StdErrPrinter { StdErrPrinter {
inner: fmt::layer() inner: fmt::layer()
.with_ansi(is_terminal) .with_ansi(is_terminal)
.with_target(false) .with_target(false)
.with_timer(LocalTime::new(Rfc3339)) .with_timer(ChronoLocal::with_format("%F %T".to_owned()))
.with_writer(std::io::stderr), .with_writer(std::io::stderr),
level: Level::DEBUG, level: Level::DEBUG,
} }
} }
fn debug_json_terminal_printer<S>() -> StdErrPrinter<StdErrJsonLayer<S, LocalTime<Rfc3339>>> { fn debug_json_terminal_printer<S>() -> StdErrPrinter<StdErrJsonLayer<S, ChronoLocal>> {
let is_terminal = atty::is(atty::Stream::Stderr); let is_terminal = atty::is(atty::Stream::Stderr);
StdErrPrinter { StdErrPrinter {
inner: fmt::layer() inner: fmt::layer()
.with_ansi(is_terminal) .with_ansi(is_terminal)
.with_target(false) .with_target(false)
.with_timer(LocalTime::new(Rfc3339)) .with_timer(ChronoLocal::with_format("%F %T".to_owned()))
.json() .json()
.with_writer(std::io::stderr), .with_writer(std::io::stderr),
level: Level::DEBUG, level: Level::DEBUG,

View File

@ -41,7 +41,7 @@ impl MakeCapturingWriter {
} }
} }
impl MakeWriter<'_> for MakeCapturingWriter { impl MakeWriter for MakeCapturingWriter {
type Writer = CapturingWriter; type Writer = CapturingWriter;
fn make_writer(&self) -> Self::Writer { fn make_writer(&self) -> Self::Writer {