Projects STRLCPY alacritty Commits 97705e07
🤬
  • Remove time dependency

    In 7398e9f a regression was introduced which causes Alacritty to crash
    on startup since wayland has a keyboard repeat rate thread started
    before our logger is initialized.
    
    Since the latest version of time was rather inconvenient to use anyway
    and there is no nice solution for this issue other than downgrading the
    `time` version again, the time since startup is now logged instead of
    the local time.
    
    This should still provide all the relevant information, while getting
    rid of an unnecessary dependency. While it would be possible to also
    print the delta between log messages, this can be trivially computed so
    it has been omitted to skip adding another `Mutex` to the `Logger`
    struct.
  • Loading...
  • Christian Duerr committed 2 years ago
    97705e07
    1 parent a4db1a1f
  • ■ ■ ■ ■ ■
    CHANGELOG.md
    skipped 27 lines
    28 28  - Commands spawn from the current directory of the foreground shell in Unix-like systems
    29 29  - Remove trailing newline from strings taken from hints or simple/semantic selections
    30 30  - Builtin font is now used for box drawing characters from `U+2500` to `U+259f`
     31 +- Logs now print the time since startup instead of the local time
    31 32   
    32 33  ### Fixed
    33 34   
    skipped 938 lines
  • ■ ■ ■ ■ ■ ■
    Cargo.lock
    skipped 34 lines
    35 35   "serde_json",
    36 36   "serde_yaml",
    37 37   "structopt",
    38  - "time",
    39 38   "unicode-width",
    40 39   "wayland-client",
    41 40   "winapi 0.3.9",
    skipped 92 lines
    134 133   
    135 134  [[package]]
    136 135  name = "bumpalo"
    137  -version = "3.8.0"
     136 +version = "3.9.1"
    138 137  source = "registry+https://github.com/rust-lang/crates.io-index"
    139  -checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c"
     138 +checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"
    140 139   
    141 140  [[package]]
    142 141  name = "calloop"
    skipped 59 lines
    202 201   
    203 202  [[package]]
    204 203  name = "cmake"
    205  -version = "0.1.46"
     204 +version = "0.1.48"
    206 205  source = "registry+https://github.com/rust-lang/crates.io-index"
    207  -checksum = "b7b858541263efe664aead4a5209a4ae5c5d2811167d4ed4ee0944503f8d2089"
     206 +checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a"
    208 207  dependencies = [
    209 208   "cc",
    210 209  ]
    skipped 209 lines
    420 419  ]
    421 420   
    422 421  [[package]]
    423  -name = "derivative"
    424  -version = "2.2.0"
    425  -source = "registry+https://github.com/rust-lang/crates.io-index"
    426  -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
    427  -dependencies = [
    428  - "proc-macro2",
    429  - "quote",
    430  - "syn",
    431  -]
    432  - 
    433  -[[package]]
    434 422  name = "dirs"
    435 423  version = "3.0.2"
    436 424  source = "registry+https://github.com/rust-lang/crates.io-index"
    skipped 312 lines
    749 737   
    750 738  [[package]]
    751 739  name = "indexmap"
    752  -version = "1.7.0"
     740 +version = "1.8.0"
    753 741  source = "registry+https://github.com/rust-lang/crates.io-index"
    754  -checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
     742 +checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
    755 743  dependencies = [
    756 744   "autocfg",
    757 745   "hashbrown",
    skipped 42 lines
    800 788   
    801 789  [[package]]
    802 790  name = "itoa"
    803  -version = "0.4.8"
    804  -source = "registry+https://github.com/rust-lang/crates.io-index"
    805  -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
    806  - 
    807  -[[package]]
    808  -name = "itoa"
    809 791  version = "1.0.1"
    810 792  source = "registry+https://github.com/rust-lang/crates.io-index"
    811 793  checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
    skipped 49 lines
    861 843   
    862 844  [[package]]
    863 845  name = "libc"
    864  -version = "0.2.109"
     846 +version = "0.2.112"
    865 847  source = "registry+https://github.com/rust-lang/crates.io-index"
    866  -checksum = "f98a04dce437184842841303488f70d0188c5f51437d2a834dc097eafa909a01"
     848 +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
    867 849   
    868 850  [[package]]
    869 851  name = "libloading"
    skipped 277 lines
    1147 1129   
    1148 1130  [[package]]
    1149 1131  name = "num_enum"
    1150  -version = "0.5.4"
     1132 +version = "0.5.6"
    1151 1133  source = "registry+https://github.com/rust-lang/crates.io-index"
    1152  -checksum = "3f9bd055fb730c4f8f4f57d45d35cd6b3f0980535b056dc7ff119cee6a66ed6f"
     1134 +checksum = "720d3ea1055e4e4574c0c0b0f8c3fd4f24c4cdaf465948206dea090b57b526ad"
    1153 1135  dependencies = [
    1154  - "derivative",
    1155 1136   "num_enum_derive",
    1156 1137  ]
    1157 1138   
    1158 1139  [[package]]
    1159 1140  name = "num_enum_derive"
    1160  -version = "0.5.4"
     1141 +version = "0.5.6"
    1161 1142  source = "registry+https://github.com/rust-lang/crates.io-index"
    1162  -checksum = "486ea01961c4a818096de679a8b740b26d9033146ac5291b1c98557658f8cdd9"
     1143 +checksum = "0d992b768490d7fe0d8586d9b5745f6c49f557da6d81dc982b1d167ad4edbb21"
    1163 1144  dependencies = [
    1164 1145   "proc-macro-crate",
    1165 1146   "proc-macro2",
    skipped 32 lines
    1198 1179   
    1199 1180  [[package]]
    1200 1181  name = "once_cell"
    1201  -version = "1.8.0"
     1182 +version = "1.9.0"
    1202 1183  source = "registry+https://github.com/rust-lang/crates.io-index"
    1203  -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
     1184 +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
    1204 1185   
    1205 1186  [[package]]
    1206 1187  name = "osmesa-sys"
    skipped 88 lines
    1295 1276   
    1296 1277  [[package]]
    1297 1278  name = "proc-macro2"
    1298  -version = "1.0.33"
     1279 +version = "1.0.36"
    1299 1280  source = "registry+https://github.com/rust-lang/crates.io-index"
    1300  -checksum = "fb37d2df5df740e582f28f8560cf425f52bb267d872fe58358eadb554909f07a"
     1281 +checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
    1301 1282  dependencies = [
    1302 1283   "unicode-xid",
    1303 1284  ]
    1304 1285   
    1305 1286  [[package]]
     1287 +name = "quick-xml"
     1288 +version = "0.22.0"
     1289 +source = "registry+https://github.com/rust-lang/crates.io-index"
     1290 +checksum = "8533f14c8382aaad0d592c812ac3b826162128b65662331e1127b45c3d18536b"
     1291 +dependencies = [
     1292 + "memchr",
     1293 +]
     1294 + 
     1295 +[[package]]
    1306 1296  name = "quote"
    1307  -version = "1.0.10"
     1297 +version = "1.0.14"
    1308 1298  source = "registry+https://github.com/rust-lang/crates.io-index"
    1309  -checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
     1299 +checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d"
    1310 1300  dependencies = [
    1311 1301   "proc-macro2",
    1312 1302  ]
    skipped 43 lines
    1356 1346   
    1357 1347  [[package]]
    1358 1348  name = "ryu"
    1359  -version = "1.0.7"
     1349 +version = "1.0.9"
    1360 1350  source = "registry+https://github.com/rust-lang/crates.io-index"
    1361  -checksum = "254df5081ce98661a883445175e52efe99d1cb2a5552891d965d2f5d0cad1c16"
     1351 +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
    1362 1352   
    1363 1353  [[package]]
    1364 1354  name = "same-file"
    skipped 42 lines
    1407 1397  source = "registry+https://github.com/rust-lang/crates.io-index"
    1408 1398  checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142"
    1409 1399  dependencies = [
    1410  - "itoa 1.0.1",
     1400 + "itoa",
    1411 1401   "ryu",
    1412 1402   "serde",
    1413 1403  ]
    skipped 43 lines
    1457 1447   
    1458 1448  [[package]]
    1459 1449  name = "signal-hook"
    1460  -version = "0.3.12"
     1450 +version = "0.3.13"
    1461 1451  source = "registry+https://github.com/rust-lang/crates.io-index"
    1462  -checksum = "c35dfd12afb7828318348b8c408383cf5071a086c1d4ab1c0f9840ec92dbb922"
     1452 +checksum = "647c97df271007dcea485bb74ffdb57f2e683f1306c854f468a0c244badabf2d"
    1463 1453  dependencies = [
    1464 1454   "libc",
    1465 1455   "signal-hook-registry",
    skipped 105 lines
    1571 1561   
    1572 1562  [[package]]
    1573 1563  name = "syn"
    1574  -version = "1.0.82"
     1564 +version = "1.0.85"
    1575 1565  source = "registry+https://github.com/rust-lang/crates.io-index"
    1576  -checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"
     1566 +checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7"
    1577 1567  dependencies = [
    1578 1568   "proc-macro2",
    1579 1569   "quote",
    skipped 30 lines
    1610 1600  ]
    1611 1601   
    1612 1602  [[package]]
    1613  -name = "time"
    1614  -version = "0.3.5"
    1615  -source = "registry+https://github.com/rust-lang/crates.io-index"
    1616  -checksum = "41effe7cfa8af36f439fac33861b66b049edc6f9a32331e2312660529c1c24ad"
    1617  -dependencies = [
    1618  - "itoa 0.4.8",
    1619  - "libc",
    1620  - "time-macros",
    1621  -]
    1622  - 
    1623  -[[package]]
    1624  -name = "time-macros"
    1625  -version = "0.2.3"
    1626  -source = "registry+https://github.com/rust-lang/crates.io-index"
    1627  -checksum = "25eb0ca3468fc0acc11828786797f6ef9aa1555e4a211a60d64cc8e4d1be47d6"
    1628  - 
    1629  -[[package]]
    1630 1603  name = "toml"
    1631 1604  version = "0.5.8"
    1632 1605  source = "registry+https://github.com/rust-lang/crates.io-index"
    skipped 34 lines
    1667 1640   
    1668 1641  [[package]]
    1669 1642  name = "version_check"
    1670  -version = "0.9.3"
     1643 +version = "0.9.4"
    1671 1644  source = "registry+https://github.com/rust-lang/crates.io-index"
    1672  -checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
     1645 +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
    1673 1646   
    1674 1647  [[package]]
    1675 1648  name = "vswhom"
    skipped 306 lines
    1982 1955   
    1983 1956  [[package]]
    1984 1957  name = "x11-clipboard"
    1985  -version = "0.5.2"
     1958 +version = "0.5.3"
    1986 1959  source = "registry+https://github.com/rust-lang/crates.io-index"
    1987  -checksum = "b397ace6e980510de59a4fe3d4c758dffab231d6d747ce9fa1aba6b6035d5f32"
     1960 +checksum = "473068b7b80ac86a18328824f1054e5e007898c47b5bbc281bd7abe32bc3653c"
    1988 1961  dependencies = [
    1989 1962   "xcb",
    1990 1963  ]
    skipped 11 lines
    2002 1975   
    2003 1976  [[package]]
    2004 1977  name = "xcb"
    2005  -version = "0.9.0"
     1978 +version = "0.10.1"
    2006 1979  source = "registry+https://github.com/rust-lang/crates.io-index"
    2007  -checksum = "62056f63138b39116f82a540c983cc11f1c90cd70b3d492a70c25eaa50bd22a6"
     1980 +checksum = "771e2b996df720cd1c6dd9ff90f62d91698fd3610cc078388d0564bdd6622a9c"
    2008 1981  dependencies = [
    2009 1982   "libc",
    2010 1983   "log",
     1984 + "quick-xml",
    2011 1985  ]
    2012 1986   
    2013 1987  [[package]]
    skipped 32 lines
  • ■ ■ ■ ■ ■
    alacritty/Cargo.toml
    skipped 19 lines
    20 20  [dependencies]
    21 21  structopt = "0.3.22"
    22 22  log = { version = "0.4", features = ["std", "serde"] }
    23  -time = { version = "0.3.5", features = ["formatting", "local-offset", "macros"] }
    24 23  fnv = "1"
    25 24  serde = { version = "1", features = ["derive"] }
    26 25  serde_yaml = "0.8"
    skipped 44 lines
  • ■ ■ ■ ■ ■ ■
    alacritty/src/logging.rs
    skipped 8 lines
    9 9  use std::path::PathBuf;
    10 10  use std::sync::atomic::{AtomicBool, Ordering};
    11 11  use std::sync::{Arc, Mutex};
     12 +use std::time::Instant;
    12 13  use std::{env, process};
    13 14   
    14 15  use glutin::event_loop::EventLoopProxy;
    15 16  use log::{self, Level, LevelFilter};
    16  -use time::macros::format_description;
    17  -use time::{OffsetDateTime, UtcOffset};
    18 17   
    19 18  use crate::cli::Options;
    20 19  use crate::event::{Event, EventType};
    skipped 22 lines
    43 42   logfile: Mutex<OnDemandLogFile>,
    44 43   stdout: Mutex<LineWriter<Stdout>>,
    45 44   event_proxy: Mutex<EventLoopProxy<Event>>,
    46  - tz_offset: UtcOffset,
     45 + start: Instant,
    47 46  }
    48 47   
    49 48  impl Logger {
    skipped 1 lines
    51 50   let logfile = Mutex::new(OnDemandLogFile::new());
    52 51   let stdout = Mutex::new(LineWriter::new(io::stdout()));
    53 52   
    54  - Logger {
    55  - logfile,
    56  - stdout,
    57  - event_proxy: Mutex::new(event_proxy),
    58  - tz_offset: UtcOffset::current_local_offset().expect("local timezone offset"),
    59  - }
     53 + Logger { logfile, stdout, event_proxy: Mutex::new(event_proxy), start: Instant::now() }
    60 54   }
    61 55   
    62 56   fn file_path(&self) -> Option<PathBuf> {
    skipped 53 lines
    116 110   }
    117 111   
    118 112   // Create log message for the given `record` and `target`.
    119  - let message = create_log_message(record, target, self.tz_offset);
     113 + let message = create_log_message(record, target, self.start);
    120 114   
    121 115   if let Ok(mut logfile) = self.logfile.lock() {
    122 116   // Write to logfile.
    skipped 12 lines
    135 129   fn flush(&self) {}
    136 130  }
    137 131   
    138  -fn create_log_message(record: &log::Record<'_>, target: &str, tz_offset: UtcOffset) -> String {
    139  - let time_format = format_description!(
    140  - "[year]-[month]-[day] [hour repr:24]:[minute]:[second].[subsecond digits:9]"
    141  - );
    142  - let now = OffsetDateTime::now_utc().to_offset(tz_offset).format(time_format).unwrap();
    143  - let mut message = format!("[{}] [{:<5}] [{}] ", now, record.level(), target);
     132 +fn create_log_message(record: &log::Record<'_>, target: &str, start: Instant) -> String {
     133 + let runtime = start.elapsed();
     134 + let secs = runtime.as_secs();
     135 + let nanos = runtime.subsec_nanos();
     136 + let mut message = format!("[{}.{:0>9}s] [{:<5}] [{}] ", secs, nanos, record.level(), target);
    144 137   
    145 138   // Alignment for the lines after the first new line character in the payload. We don't deal
    146 139   // with fullwidth/unicode chars here, so just `message.len()` is sufficient.
    skipped 81 lines
Please wait...
Page is in error, reload to recover