nanomsg/nanomsg — pull request #160 by tailhook (2013-09-27 13:28:56+00:00)
Title: Monitoring internals

This branch is probably finished. I've added two environment variables, that are useful for debugging:
```
NN_PRINT_ERRORS=1
```
which prints connection errors:
```
nanomsg: socket.0[127.0.0.1:1234]: Error: Connection refused
```

And another one for statistics:
```
NN_PRINT_STATISTICS=1
```
which prints some info on 10 second interval:
```
nanomsg: socket.hello: established_connections: 0
nanomsg: socket.hello: accepted_connections: 0
nanomsg: socket.hello: dropped_connections: 0
nanomsg: socket.hello: broken_connections: 0
nanomsg: socket.hello: connect_errors: 101
nanomsg: socket.hello: bind_errors: 0
nanomsg: socket.hello: accept_errors: 0
nanomsg: socket.hello: messages_sent: 0
nanomsg: socket.hello: messages_received: 0
nanomsg: socket.hello: bytes_sent: 0
nanomsg: socket.hello: bytes_received: 0
nanomsg: socket.hello: current_connections: 0
nanomsg: socket.hello: inprogress_connections: 0
nanomsg: socket.hello: current_snd_priority: 0
nanomsg: socket.hello: current_ep_errors: 1
```

Both print on stderr and will be documented for debugging purposes only.

Also added `NN_SOCKET_NAME` option to set socket names (Will actually be useful when statistics is sent though a network)

I'll add man page and squash the changes before merging