Bläddra i källkod

Use log, env_logger crates for logging

Johannes Hofmann 8 år sedan
förälder
incheckning
f1a6922601
7 ändrade filer med 164 tillägg och 21 borttagningar
  1. 122
    0
      Cargo.lock
  2. 9
    0
      Cargo.toml
  3. 5
    3
      src/config.rs
  4. 11
    7
      src/context.rs
  5. 9
    6
      src/main.rs
  6. 5
    5
      src/program.rs
  7. 3
    0
      src/tile_loader.rs

+ 122
- 0
Cargo.lock Visa fil

@@ -3,6 +3,14 @@ name = "adler32"
3 3
 version = "1.0.2"
4 4
 source = "registry+https://github.com/rust-lang/crates.io-index"
5 5
 
6
+[[package]]
7
+name = "aho-corasick"
8
+version = "0.6.4"
9
+source = "registry+https://github.com/rust-lang/crates.io-index"
10
+dependencies = [
11
+ "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
12
+]
13
+
6 14
 [[package]]
7 15
 name = "android_glue"
8 16
 version = "0.2.3"
@@ -106,6 +114,15 @@ dependencies = [
106 114
  "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
107 115
 ]
108 116
 
117
+[[package]]
118
+name = "chrono"
119
+version = "0.4.0"
120
+source = "registry+https://github.com/rust-lang/crates.io-index"
121
+dependencies = [
122
+ "num 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
123
+ "time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
124
+]
125
+
109 126
 [[package]]
110 127
 name = "clap"
111 128
 version = "2.29.1"
@@ -213,10 +230,12 @@ name = "deltamap"
213 230
 version = "0.1.0"
214 231
 dependencies = [
215 232
  "clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)",
233
+ "env_logger 0.5.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)",
216 234
  "gl 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
217 235
  "gl_generator 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
218 236
  "image 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
219 237
  "linked-hash-map 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
238
+ "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
220 239
  "osmpbf 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
221 240
  "reqwest 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
222 241
  "servo-glutin 0.13.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -251,6 +270,17 @@ dependencies = [
251 270
  "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
252 271
 ]
253 272
 
273
+[[package]]
274
+name = "env_logger"
275
+version = "0.5.0-rc.2"
276
+source = "registry+https://github.com/rust-lang/crates.io-index"
277
+dependencies = [
278
+ "chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
279
+ "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
280
+ "regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
281
+ "termcolor 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
282
+]
283
+
254 284
 [[package]]
255 285
 name = "error-chain"
256 286
 version = "0.11.0"
@@ -557,6 +587,14 @@ name = "matches"
557 587
 version = "0.1.6"
558 588
 source = "registry+https://github.com/rust-lang/crates.io-index"
559 589
 
590
+[[package]]
591
+name = "memchr"
592
+version = "2.0.1"
593
+source = "registry+https://github.com/rust-lang/crates.io-index"
594
+dependencies = [
595
+ "libc 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)",
596
+]
597
+
560 598
 [[package]]
561 599
 name = "memmap"
562 600
 version = "0.6.2"
@@ -649,6 +687,16 @@ dependencies = [
649 687
  "ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
650 688
 ]
651 689
 
690
+[[package]]
691
+name = "num"
692
+version = "0.1.41"
693
+source = "registry+https://github.com/rust-lang/crates.io-index"
694
+dependencies = [
695
+ "num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
696
+ "num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)",
697
+ "num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
698
+]
699
+
652 700
 [[package]]
653 701
 name = "num-integer"
654 702
 version = "0.1.35"
@@ -853,6 +901,23 @@ dependencies = [
853 901
  "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
854 902
 ]
855 903
 
904
+[[package]]
905
+name = "regex"
906
+version = "0.2.5"
907
+source = "registry+https://github.com/rust-lang/crates.io-index"
908
+dependencies = [
909
+ "aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
910
+ "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
911
+ "regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
912
+ "thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
913
+ "utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
914
+]
915
+
916
+[[package]]
917
+name = "regex-syntax"
918
+version = "0.4.2"
919
+source = "registry+https://github.com/rust-lang/crates.io-index"
920
+
856 921
 [[package]]
857 922
 name = "relay"
858 923
 version = "0.1.0"
@@ -1047,6 +1112,14 @@ dependencies = [
1047 1112
  "rand 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)",
1048 1113
 ]
1049 1114
 
1115
+[[package]]
1116
+name = "termcolor"
1117
+version = "0.3.3"
1118
+source = "registry+https://github.com/rust-lang/crates.io-index"
1119
+dependencies = [
1120
+ "wincolor 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
1121
+]
1122
+
1050 1123
 [[package]]
1051 1124
 name = "termion"
1052 1125
 version = "1.5.1"
@@ -1065,6 +1138,15 @@ dependencies = [
1065 1138
  "unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
1066 1139
 ]
1067 1140
 
1141
+[[package]]
1142
+name = "thread_local"
1143
+version = "0.3.5"
1144
+source = "registry+https://github.com/rust-lang/crates.io-index"
1145
+dependencies = [
1146
+ "lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
1147
+ "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
1148
+]
1149
+
1068 1150
 [[package]]
1069 1151
 name = "time"
1070 1152
 version = "0.1.39"
@@ -1178,6 +1260,14 @@ name = "unicode-width"
1178 1260
 version = "0.1.4"
1179 1261
 source = "registry+https://github.com/rust-lang/crates.io-index"
1180 1262
 
1263
+[[package]]
1264
+name = "unreachable"
1265
+version = "1.0.0"
1266
+source = "registry+https://github.com/rust-lang/crates.io-index"
1267
+dependencies = [
1268
+ "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
1269
+]
1270
+
1181 1271
 [[package]]
1182 1272
 name = "url"
1183 1273
 version = "1.6.0"
@@ -1197,6 +1287,11 @@ dependencies = [
1197 1287
  "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
1198 1288
 ]
1199 1289
 
1290
+[[package]]
1291
+name = "utf8-ranges"
1292
+version = "1.0.0"
1293
+source = "registry+https://github.com/rust-lang/crates.io-index"
1294
+
1200 1295
 [[package]]
1201 1296
 name = "uuid"
1202 1297
 version = "0.5.1"
@@ -1220,6 +1315,11 @@ name = "version_check"
1220 1315
 version = "0.1.3"
1221 1316
 source = "registry+https://github.com/rust-lang/crates.io-index"
1222 1317
 
1318
+[[package]]
1319
+name = "void"
1320
+version = "1.0.2"
1321
+source = "registry+https://github.com/rust-lang/crates.io-index"
1322
+
1223 1323
 [[package]]
1224 1324
 name = "winapi"
1225 1325
 version = "0.2.8"
@@ -1249,6 +1349,15 @@ name = "winapi-x86_64-pc-windows-gnu"
1249 1349
 version = "0.3.2"
1250 1350
 source = "registry+https://github.com/rust-lang/crates.io-index"
1251 1351
 
1352
+[[package]]
1353
+name = "wincolor"
1354
+version = "0.1.4"
1355
+source = "registry+https://github.com/rust-lang/crates.io-index"
1356
+dependencies = [
1357
+ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
1358
+ "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
1359
+]
1360
+
1252 1361
 [[package]]
1253 1362
 name = "ws2_32-sys"
1254 1363
 version = "0.2.1"
@@ -1283,6 +1392,7 @@ dependencies = [
1283 1392
 
1284 1393
 [metadata]
1285 1394
 "checksum adler32 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6cbd0b9af8587c72beadc9f72d35b9fbb070982c9e6203e46e93f10df25f8f45"
1395
+"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4"
1286 1396
 "checksum android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407"
1287 1397
 "checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455"
1288 1398
 "checksum atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8352656fd42c30a0c3c89d26dea01e3b77c0ab2af18230835c15e2e13cd51859"
@@ -1298,6 +1408,7 @@ dependencies = [
1298 1408
 "checksum cc 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "deaf9ec656256bb25b404c51ef50097207b9cbb29c933d31f92cae5a8a0ffee0"
1299 1409
 "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
1300 1410
 "checksum cgl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "86765cb42c2a2c497e142af72517c1b4d7ae5bb2f25dfa77a5c69642f2342d89"
1411
+"checksum chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c20ebe0b2b08b0aeddba49c609fe7957ba2e33449882cb186a180bc60682fa9"
1301 1412
 "checksum clap 2.29.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8f4a2b3bb7ef3c672d7c13d15613211d5a6976b6892c598b0fcb5d40765f19c2"
1302 1413
 "checksum coco 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c06169f5beb7e31c7c67ebf5540b8b472d23e3eade3b2ec7d1f5b504a85f91bd"
1303 1414
 "checksum cocoa 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac0d785ff4faf0ff23d7b5561346bb50dc7ef9a11cb0e65e07ef776b7752938f"
@@ -1313,6 +1424,7 @@ dependencies = [
1313 1424
 "checksum dwmapi-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b44b6442aeab12e609aee505bd1066bdfd36b79c3fe5aad604aae91537623e76"
1314 1425
 "checksum either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "740178ddf48b1a9e878e6d6509a1442a2d42fd2928aae8e7a6f8a36fb01981b3"
1315 1426
 "checksum enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180"
1427
+"checksum env_logger 0.5.0-rc.2 (registry+https://github.com/rust-lang/crates.io-index)" = "65f98e626dd2495a575f6036dd73c9176b656dd73d8bdf8119f2cf5223a2ec4a"
1316 1428
 "checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3"
1317 1429
 "checksum flate2 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)" = "e6234dd4468ae5d1e2dbb06fe2b058696fdc50a339c68a393aefbf00bc81e423"
1318 1430
 "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1"
@@ -1350,6 +1462,7 @@ dependencies = [
1350 1462
 "checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084"
1351 1463
 "checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
1352 1464
 "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
1465
+"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
1353 1466
 "checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"
1354 1467
 "checksum mime 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e2e00e17be181010a91dbfefb01660b17311059dc8c7f48b9017677721e732bd"
1355 1468
 "checksum mime_guess 2.0.0-alpha.3 (registry+https://github.com/rust-lang/crates.io-index)" = "013572795763289e14710c7b279461295f2673b2b338200c235082cd7ca9e495"
@@ -1358,6 +1471,7 @@ dependencies = [
1358 1471
 "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
1359 1472
 "checksum native-tls 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f74dbadc8b43df7864539cedb7bc91345e532fdd913cfdc23ad94f4d2d40fbc0"
1360 1473
 "checksum net2 0.2.31 (registry+https://github.com/rust-lang/crates.io-index)" = "3a80f842784ef6c9a958b68b7516bc7e35883c614004dd94959a4dca1b716c09"
1474
+"checksum num 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "cc4083e14b542ea3eb9b5f33ff48bd373a92d78687e74f4cc0a30caeb754f0ca"
1361 1475
 "checksum num-integer 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "d1452e8b06e448a07f0e6ebb0bb1d92b8890eea63288c0b627331d53514d0fba"
1362 1476
 "checksum num-iter 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)" = "7485fcc84f85b4ecd0ea527b14189281cf27d60e583ae65ebc9c088b13dffe01"
1363 1477
 "checksum num-rational 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "0c7cb72a95250d8a370105c828f388932373e0e94414919891a0f945222310fe"
@@ -1382,6 +1496,8 @@ dependencies = [
1382 1496
 "checksum rayon-core 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e64b609139d83da75902f88fd6c01820046840a18471e4dfcd5ac7c0f46bea53"
1383 1497
 "checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
1384 1498
 "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
1499
+"checksum regex 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "744554e01ccbd98fff8c457c3b092cd67af62a555a43bfe97ae8a0451f7799fa"
1500
+"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e"
1385 1501
 "checksum relay 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f301bafeb60867c85170031bdb2fcf24c8041f33aee09e7b116a58d4e9f781c5"
1386 1502
 "checksum reqwest 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3161ca63fd11ce36c7718af239e6492a25a3dbfcec54240f959b9d816cf42413"
1387 1503
 "checksum rustc-demangle 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "aee45432acc62f7b9a108cc054142dac51f979e69e71ddce7d6fc7adf29e817e"
@@ -1405,8 +1521,10 @@ dependencies = [
1405 1521
 "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694"
1406 1522
 "checksum take 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b157868d8ac1f56b64604539990685fa7611d8fa9e5476cf0c02cf34d32917c5"
1407 1523
 "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6"
1524
+"checksum termcolor 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9065bced9c3e43453aa3d56f1e98590b8455b341d2fa191a1090c0dd0b242c75"
1408 1525
 "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
1409 1526
 "checksum textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c0b59b6b4b44d867f1370ef1bd91bfb262bf07bf0ae65c202ea2fbc16153b693"
1527
+"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"
1410 1528
 "checksum time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "a15375f1df02096fb3317256ce2cee6a1f42fc84ea5ad5fc8c421cfe40c73098"
1411 1529
 "checksum tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "52b4e32d8edbf29501aabb3570f027c6ceb00ccef6538f4bddba0200503e74e8"
1412 1530
 "checksum tokio-io 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "514aae203178929dbf03318ad7c683126672d4d96eccb77b29603d33c9e25743"
@@ -1419,17 +1537,21 @@ dependencies = [
1419 1537
 "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
1420 1538
 "checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f"
1421 1539
 "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
1540
+"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
1422 1541
 "checksum url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa35e768d4daf1d85733418a49fb42e10d7f633e394fccab4ab7aba897053fe2"
1423 1542
 "checksum user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ef4711d107b21b410a3a974b1204d9accc8b10dad75d8324b5d755de1617d47"
1543
+"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
1424 1544
 "checksum uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22"
1425 1545
 "checksum vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9e0a7d8bed3178a8fb112199d466eeca9ed09a14ba8ad67718179b4fd5487d0b"
1426 1546
 "checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
1427 1547
 "checksum version_check 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6b772017e347561807c1aa192438c5fd74242a670a6cffacc40f2defd1dc069d"
1548
+"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
1428 1549
 "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
1429 1550
 "checksum winapi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b09fb3b6f248ea4cd42c9a65113a847d612e17505d6ebd1f7357ad68a8bf8693"
1430 1551
 "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
1431 1552
 "checksum winapi-i686-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ec6667f60c23eca65c561e63a13d81b44234c2e38a6b6c959025ee907ec614cc"
1432 1553
 "checksum winapi-x86_64-pc-windows-gnu 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98f12c52b2630cd05d2c3ffd8e008f7f48252c042b4871c72aed9dc733b96668"
1554
+"checksum wincolor 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a39ee4464208f6430992ff20154216ab2357772ac871d994c51628d60e58b8b0"
1433 1555
 "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
1434 1556
 "checksum x11-dl 2.17.2 (registry+https://github.com/rust-lang/crates.io-index)" = "28ec50063128cfdbdfe683b0504a3740e07b779c7c75fa26e941218b5f95e098"
1435 1557
 "checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61"

+ 9
- 0
Cargo.toml Visa fil

@@ -2,12 +2,21 @@
2 2
 name = "deltamap"
3 3
 version = "0.1.0"
4 4
 authors = ["Johannes Hofmann <mail@b-r-u.org>"]
5
+readme = "README.md"
6
+repository = "https://github.com/b-r-u/deltamap"
7
+homepage = "https://github.com/b-r-u/deltamap"
8
+description = """
9
+A simple map viewer
10
+"""
11
+license = "GPL-3.0"
5 12
 
6 13
 [dependencies]
7 14
 clap = "2.29"
15
+env_logger = "0.5.0-rc.2"
8 16
 gl = "0.9"
9 17
 image = "0.18"
10 18
 linked-hash-map = "0.5.0"
19
+log = "0.4"
11 20
 osmpbf = "0.1"
12 21
 reqwest = "0.8"
13 22
 servo-glutin = "0.13"

+ 5
- 3
src/config.rs Visa fil

@@ -19,21 +19,23 @@ impl Config {
19 19
     pub fn load() -> Result<Config, String> {
20 20
         if let Ok(xdg_dirs) = xdg::BaseDirectories::with_prefix("deltamap") {
21 21
             if let Some(config_path) = xdg_dirs.find_config_file("config.toml") {
22
-                println!("Load config from path {:?}", config_path);
22
+                info!("load config from path {:?}", config_path);
23 23
 
24 24
                 Config::from_toml_file(config_path)
25 25
             } else {
26 26
                 // try to write a default config file
27 27
                 if let Ok(path) = xdg_dirs.place_config_file("config.toml") {
28 28
                     if let Ok(mut file) = File::create(&path) {
29
-                        println!("write default config {:?}", &path);
30
-                        let _ = file.write_all(DEFAULT_CONFIG.as_bytes());
29
+                        if file.write_all(DEFAULT_CONFIG.as_bytes()).is_ok() {
30
+                            info!("write default config to {:?}", &path);
31
+                        }
31 32
                     }
32 33
                 }
33 34
 
34 35
                 Config::from_toml_str(DEFAULT_CONFIG)
35 36
             }
36 37
         } else {
38
+            info!("load default config");
37 39
             Config::from_toml_str(DEFAULT_CONFIG)
38 40
         }
39 41
     }

+ 11
- 7
src/context.rs Visa fil

@@ -29,8 +29,12 @@ macro_rules! check_gl_errors {
29 29
 impl Context {
30 30
     pub fn from_window(window: &glutin::Window) -> Context {
31 31
         let gl = gl::Gl::load_with(|ptr| window.get_proc_address(ptr) as *const _);
32
+        let cx = Context {gl: gl};
32 33
 
33
-        Context {gl: gl}
34
+        info!("OpenGL version: {}", cx.gl_version());
35
+        debug!("MAX_TEXTURE_SIZE: {}", cx.max_texture_size());
36
+
37
+        cx
34 38
     }
35 39
 
36 40
     pub fn gl_version(&self) -> String {
@@ -53,22 +57,22 @@ impl Context {
53 57
             match self.gl.GetError() {
54 58
                 gl::NO_ERROR => break,
55 59
                 gl::INVALID_VALUE => {
56
-                    println!("{}:{}, invalid value error", file, line);
60
+                    error!("{}:{}, invalid value error", file, line);
57 61
                 },
58 62
                 gl::INVALID_ENUM => {
59
-                    println!("{}:{}, invalid enum error", file, line);
63
+                    error!("{}:{}, invalid enum error", file, line);
60 64
                 },
61 65
                 gl::INVALID_OPERATION => {
62
-                    println!("{}:{}, invalid operation error", file, line);
66
+                    error!("{}:{}, invalid operation error", file, line);
63 67
                 },
64 68
                 gl::INVALID_FRAMEBUFFER_OPERATION => {
65
-                    println!("{}:{}, invalid framebuffer operation error", file, line);
69
+                    error!("{}:{}, invalid framebuffer operation error", file, line);
66 70
                 },
67 71
                 gl::OUT_OF_MEMORY => {
68
-                    println!("{}:{}, out of memory error", file, line);
72
+                    error!("{}:{}, out of memory error", file, line);
69 73
                 },
70 74
                 x => {
71
-                    println!("{}:{}, unknown error {}", file, line, x);
75
+                    error!("{}:{}, unknown error {}", file, line, x);
72 76
                 },
73 77
             }
74 78
         }

+ 9
- 6
src/main.rs Visa fil

@@ -1,7 +1,11 @@
1
+#[macro_use]
1 2
 extern crate clap;
3
+extern crate env_logger;
2 4
 extern crate glutin;
3 5
 extern crate image;
4 6
 extern crate linked_hash_map;
7
+#[macro_use]
8
+extern crate log;
5 9
 extern crate reqwest;
6 10
 extern crate toml;
7 11
 extern crate xdg;
@@ -30,9 +34,6 @@ use std::time::{Duration, Instant};
30 34
 use tile_source::TileSource;
31 35
 
32 36
 
33
-static VERSION: &'static str = "0.1.0";
34
-
35
-
36 37
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
37 38
 enum Action {
38 39
     Nothing,
@@ -157,10 +158,12 @@ fn handle_event(event: &Event, map: &mut MapViewGl, input_state: &mut InputState
157 158
 }
158 159
 
159 160
 fn main() {
161
+    env_logger::init();
162
+
160 163
     let matches = clap::App::new("DeltaMap")
161
-        .version(VERSION)
162
-        .author("Johannes Hofmann <mail@b-r-u.org>")
163
-        .about("A map viewer")
164
+        .version(crate_version!())
165
+        .author(crate_authors!())
166
+        .about(crate_description!())
164 167
         .arg(Arg::with_name("config")
165 168
             .short("c")
166 169
             .long("config")

+ 5
- 5
src/program.rs Visa fil

@@ -149,15 +149,15 @@ unsafe fn check_link_errors(cx: &Context, program_obj: u32)
149 149
         match cx.gl.GetError() {
150 150
             context::gl::NO_ERROR => (),
151 151
             context::gl::INVALID_VALUE => {
152
-                println!("invalid value");
152
+                error!("invalid value");
153 153
                 return;
154 154
             },
155 155
             context::gl::INVALID_OPERATION => {
156
-                println!("invalid operation");
156
+                error!("invalid operation");
157 157
                 return;
158 158
             },
159 159
             _ => {
160
-                println!("unknown error");
160
+                error!("unknown error");
161 161
                 return;
162 162
             }
163 163
         };
@@ -174,7 +174,7 @@ unsafe fn check_link_errors(cx: &Context, program_obj: u32)
174 174
         error_log.set_len(error_log_size as usize);
175 175
 
176 176
         let msg = String::from_utf8(error_log).unwrap();
177
-        println!("{}", msg);
177
+        error!("{}", msg);
178 178
     }
179 179
 }
180 180
 
@@ -197,7 +197,7 @@ unsafe fn check_compile_errors(cx: &Context, shader_obj: u32) {
197 197
         error_log.set_len(error_log_size as usize);
198 198
 
199 199
         if let Ok(msg) = String::from_utf8(error_log) {
200
-            println!("{}", msg);
200
+            error!("{}", msg);
201 201
         }
202 202
     }
203 203
 }

+ 3
- 0
src/tile_loader.rs Visa fil

@@ -168,6 +168,8 @@ impl TileLoader {
168 168
                             client_opt = Client::builder().build().ok();
169 169
                         }
170 170
 
171
+                        info!("thread {}, download {:?}", thread_id, request.url);
172
+
171 173
                         if let Some(Ok(mut response)) = client_opt.as_ref().map(|c| c.get(&request.url).send()) {
172 174
                             let mut buf: Vec<u8> = vec![];
173 175
                             if response.copy_to(&mut buf).is_ok() {
@@ -191,6 +193,7 @@ impl TileLoader {
191 193
                         }
192 194
 
193 195
                         // failed not load tile
196
+                        info!("thread {}, fail {:?}", thread_id, request.url);
194 197
                         if result_tx.send((request.tile, None)).is_err() {
195 198
                             break;
196 199
                         }