libmoost
/home/mhx/git/github/libmoost/include/moost/shell.hpp
Go to the documentation of this file.
00001 /* vim:set ts=3 sw=3 sts=3 et: */
00028 #ifndef MOOST_SHELL_H__
00029 #define MOOST_SHELL_H__
00030 
00031 #include "service/remote_shell.h"
00032 #include "service/appender.h"
00033 
00034 namespace moost {
00035 
00036 // A thin, backwards-compatible wrapper to use the "local" part
00037 // of moost::service::remote_shell in an easy way.
00038 
00039 template <class HandlerType>
00040 class shell : public service::remote_shell<HandlerType>
00041 {
00042 public:
00043    shell(HandlerType& handler)
00044       : service::remote_shell<HandlerType>(handler)
00045    {
00046       this->enable_local_shell();
00047    }
00048 
00049    shell(HandlerType& handler, const std::string& log_level)
00050       : service::remote_shell<HandlerType>(handler)
00051    {
00052       this->enable_local_shell();
00053       this->set_appender_factory(moost::service::appender_factory_ptr(
00054          new service::log4cxx_appender_factory(log_level)
00055       ));
00056    }
00057 };
00058 
00059 }
00060 
00061 #endif /* MOOST_SHELL_H */