docs: ✏️ add notes on debugging

This commit is contained in:
Stepan Kuzmin 2019-02-04 20:22:02 +03:00
parent ca8b330544
commit cbe9e89909
3 changed files with 66 additions and 46 deletions

View File

@ -6,7 +6,7 @@
Martin is a [PostGIS](https://github.com/postgis/postgis) [vector tiles](https://github.com/mapbox/vector-tile-spec) server suitable for large databases. Martin is written in [Rust](https://github.com/rust-lang/rust) using [Actix](https://github.com/actix/actix-web) web framework. Martin is a [PostGIS](https://github.com/postgis/postgis) [vector tiles](https://github.com/mapbox/vector-tile-spec) server suitable for large databases. Martin is written in [Rust](https://github.com/rust-lang/rust) using [Actix](https://github.com/actix/actix-web) web framework.
![Martin](https://raw.githubusercontent.com/urbica/martin/master/mart.png) ![Martin](https://raw.githubusercontent.com/urbica/martin/master/logo.png)
- [Requirements](#requirements) - [Requirements](#requirements)
- [Installation](#installation) - [Installation](#installation)
@ -26,6 +26,7 @@ Martin is a [PostGIS](https://github.com/postgis/postgis) [vector tiles](https:/
- [Using with Docker](#using-with-docker) - [Using with Docker](#using-with-docker)
- [Using with Nginx](#using-with-nginx) - [Using with Nginx](#using-with-nginx)
- [Building from Source](#building-from-source) - [Building from Source](#building-from-source)
- [Debugging](#debugging)
- [Development](#development) - [Development](#development)
## Requirements ## Requirements
@ -309,7 +310,7 @@ docker run \
## Using with Nginx ## Using with Nginx
If you are running martin behind nginx proxy, you may want to rewrite request URL, so martin can properly handle tile urls in TileJSON endpoints. If you are running martin behind nginx proxy, you may want to rewrite request URL, to properly handle tile urls in [TileJSON](#table-source-tilejson) [endpoints](#function-source-tilejson).
```nginx ```nginx
location ~ /tiles/(?<fwd_path>.*) { location ~ /tiles/(?<fwd_path>.*) {
@ -335,6 +336,17 @@ cd ./target/release/
./martin postgres://postgres@localhost/db ./martin postgres://postgres@localhost/db
``` ```
## Debugging
Log levels are controlled on a per-module basis, and by default all logging is disabled except for errors. Logging is controlled via the `RUST_LOG` environment variable. The value of this environment variable is a comma-separated list of logging directives.
This will enable verbose logging for the `actix_web` module and enable debug logging for the `martin` and `postgres` modules:
```shell
export RUST_LOG=actix_web=info,martin=debug,postgres=debug
martin postgres://postgres@localhost/db
```
## Development ## Development
Install project dependencies and check if all the tests are running. Install project dependencies and check if all the tests are running.

View File

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -1,12 +1,18 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta charset='utf-8' /> <meta charset="utf-8" />
<title>Martin Debug</title> <title>Martin Debug Page</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> <meta
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.49.0/mapbox-gl.js'></script> name="viewport"
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.49.0/mapbox-gl.css' rel='stylesheet' /> content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<script src="https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.js"></script>
<link
href="https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.css"
rel="stylesheet"
/>
<style> <style>
body { body {
margin: 0; margin: 0;
@ -23,11 +29,11 @@
</head> </head>
<body> <body>
<div id="map"></div>
<div id='map'></div>
<script> <script>
mapboxgl.accessToken = 'pk.eyJ1Ijoic3RlcGFua3V6bWluIiwiYSI6Ik1ieW5udm8ifQ.25EOEC2-N92NCWT0Ci9w-Q'; mapboxgl.accessToken =
'pk.eyJ1Ijoic3RlcGFua3V6bWluIiwiYSI6Ik1ieW5udm8ifQ.25EOEC2-N92NCWT0Ci9w-Q';
var map = new mapboxgl.Map({ var map = new mapboxgl.Map({
container: 'map', container: 'map',
@ -38,17 +44,19 @@
map.on('load', function() { map.on('load', function() {
map.addLayer({ map.addLayer({
"id": "public.points", id: 'public.points',
"type": "circle", type: 'circle',
"source": { source: {
"type": "vector", type: 'vector',
"url": "http://localhost:3000/public.points.json", url: 'http://localhost:3000/public.points.json'
}, },
"source-layer": "public.points" 'source-layer': 'public.points'
});
map.on('click', 'public.points', function(event) {
console.log(event.features);
}); });
}); });
</script> </script>
</body> </body>
</html> </html>