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,54 +1,62 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head>
<meta charset="utf-8" />
<title>Martin Debug Page</title>
<meta
name="viewport"
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"
/>
<head> <style>
<meta charset='utf-8' /> body {
<title>Martin Debug</title> margin: 0;
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> padding: 0;
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.49.0/mapbox-gl.js'></script> }
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.49.0/mapbox-gl.css' rel='stylesheet' />
<style>
body {
margin: 0;
padding: 0;
}
#map { #map {
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
} }
</style> </style>
</head> </head>
<body> <body>
<div id="map"></div>
<div id='map'></div> <script>
mapboxgl.accessToken =
'pk.eyJ1Ijoic3RlcGFua3V6bWluIiwiYSI6Ik1ieW5udm8ifQ.25EOEC2-N92NCWT0Ci9w-Q';
<script> var map = new mapboxgl.Map({
mapboxgl.accessToken = 'pk.eyJ1Ijoic3RlcGFua3V6bWluIiwiYSI6Ik1ieW5udm8ifQ.25EOEC2-N92NCWT0Ci9w-Q'; container: 'map',
style: 'mapbox://styles/mapbox/light-v9',
var map = new mapboxgl.Map({ zoom: 0,
container: 'map', center: [0, 0]
style: 'mapbox://styles/mapbox/light-v9',
zoom: 0,
center: [0, 0]
});
map.on('load', function () {
map.addLayer({
"id": "public.points",
"type": "circle",
"source": {
"type": "vector",
"url": "http://localhost:3000/public.points.json",
},
"source-layer": "public.points"
}); });
});
</script>
</body> map.on('load', function() {
map.addLayer({
id: 'public.points',
type: 'circle',
source: {
type: 'vector',
url: 'http://localhost:3000/public.points.json'
},
'source-layer': 'public.points'
});
</html> map.on('click', 'public.points', function(event) {
console.log(event.features);
});
});
</script>
</body>
</html>