System logger is presented with new abstract interface now.
Code that works with system logger can also work with any other logger implementing this interface.
So it's easier now to write code for cocaine application that can be used without worker and service manager.
Merge pull request #1 from cocaine/common_logger

System logger is presented with a new abstract interface now.
Fixed includes. Every file must include only necessary headers.
When i moved logger interface in separate file i forgot to move corresponding includes. Also predefinition of logging_service_t no longer needed for service_t class.
Updated example to reflect changes in the logging. It now uses system logger through basic logger inteface and doesn't explicitly depend from logging service.
Service client class binds error handler on socket now. Before when cocaine-runtime crashes applications also sometimes finished incorrectly because networking library tried to call error handler (due to unexpectedly closed socket) but there was no error handler and it results in throwing of bad_function_call exception.
method_factory is not needed anymore and i removed it. Before method 'on' of application class taken only handler fabrics, so method_factory was usefull to make handlers from method of application. But now method 'on' can directly take method and make factory from it, so it can produce function_factory_t and avoid to use yet another factory. Also this commit solves problem with using of method factory and g++ 4.6: method_factory taken object of type 'function<string(shared_ptr<Class>, string, vector<string>)>' and it normally taken method of Class with g++ 4.4, but g++ 4.6 doesn't allow this.
System logger takes verbosity from logging service now. System logger does it in initialize method, but i forgot to call it.
This commit fixes two bugs. Lock in message handler of service_t is more localized now. Before this lock didn't allow to make call to service from handler of previous call to the same service object. Now lock is used only when it really needed. Second bug is that upstream (response on invoke to application) was not thread-safe. Moreover worker's communication with cocaine engine was not thread safe. So writing to one upstream or even writing to different upstreams from mulltiple threads could lead to crash. Now all communication is under lock.
Fixed unpacking of error message from service. Wrong unpacking led to throwing exception and framework didn't call error handler set by user with on_error method of future.
Hold logger by base type instead of derived, to avoid needless upcasts
Fixed stub for storage service. It must take abstract logger as argument of the constructor, not logging service. I forgot to fix it when made basic logger interface.
Avoid copypast and hide implementation details in special workspace. message_handler template handles everything corresponding to handling of message from service. handler_detail removes message handling from handlers realisation if it's not needed.
Improved functional handler. Instead of event name handler function takes event_t object that provides upstream. Having ustream function can send more than one chunk as answer or doesn't send chunks at all. For example, it's possible to process http requests in function with this new handler. Also in this commit default on_error method of basic_handler_t is added. I don't know why somebody may want to send error to application, so i don't want to write emty on_error method in every handler.
Merge branch 'new_handlers'
Don't close upstream in functional handler immediately after function is finished. I may want to save upstream somewhere and send something later (for example do async read from storage and write result into upstream).
Minor api changes in functional handler. Handler function takes upstream and event name instead of structure event_t, which includes them. Also i forgot to use std::forward in service_t::call.
'on(std::function...)' method of application class is deprecated because it's useless. Old versions of 'on' method have been returned for backward compatibility with old function handler. Also here are some minor codestyle changes in storage stub.
New very useful http handler. It allows to simply write handlers for events from fastcgi proxy. It can unpack request for user and simply send response. Also it hides from user writing to upstream.
Some minor changes in api of http_handler (more meaningful names of methods and constructor for http_response). Also added check if upstream is already closed in 'error' method because sending error to closed upstream leads in exception, but in asynchronous applications it's difficult to control how many times we want to response (for example we want send error on timed out answer from service and on error from service, and error from service will be received after timeout).
Updated example application. Changes are related to new functional handler API.