diff options
author | Alex Borisov <borisov.alexandr@rambler.ru> | 2011-12-04 02:40:31 +0200 |
---|---|---|
committer | Alex Borisov <borisov.alexandr@rambler.ru> | 2011-12-04 02:40:31 +0200 |
commit | 2362f1f3c95a49c0e2cce8b46335b0c5a7c2d807 (patch) | |
tree | 81bd3d40b540b771c5cf0e8f14611acf8c03a9d9 | |
parent | 359f661629ec43a5806af11e50bc7ae8ae615c60 (diff) | |
parent | 9525854f31970a4eef3bf10fb8bf268128245fb7 (diff) |
Merge branch 'master' of ssh://sss.chaoslab.ru//home/private_git/proxy_ui
-rw-r--r-- | server/server/config.h | 2 | ||||
-rw-r--r-- | server/server/log.cpp | 10 | ||||
-rw-r--r-- | server/server/log.h | 3 | ||||
-rw-r--r-- | server/server/main.cpp | 17 |
4 files changed, 21 insertions, 11 deletions
diff --git a/server/server/config.h b/server/server/config.h index d411411..5da2b80 100644 --- a/server/server/config.h +++ b/server/server/config.h @@ -99,7 +99,7 @@ public: timeout = t; } }; - config(const char *path); + config(const char *path = NULL); const int ban_time(); const int conn_count(); const int conn_time(); diff --git a/server/server/log.cpp b/server/server/log.cpp index 9dfddf4..4f53866 100644 --- a/server/server/log.cpp +++ b/server/server/log.cpp @@ -51,10 +51,12 @@ logtofile::logtofile(const char *pth) { if(pth) path = strdup(pth); -} -logtofile::logtofile() -{ - path = strdup("./server.log"); + else + { + std::string cfg_path = boost::filesystem::initial_path().string(); + cfg_path += "/server.log"; + path = strdup(cfg_path.c_str()); + } } logtofile::~logtofile() { diff --git a/server/server/log.h b/server/server/log.h index c55772a..f0898af 100644 --- a/server/server/log.h +++ b/server/server/log.h @@ -12,8 +12,7 @@ public: logtofile& operator<<(size_t buf); logtofile& operator<<(char buf); ~logtofile(); - logtofile(const char *pth); - logtofile(); + logtofile(const char *pth = NULL); void lock() { log_mutex2.lock(); diff --git a/server/server/main.cpp b/server/server/main.cpp index daa8a2d..1d36462 100644 --- a/server/server/main.cpp +++ b/server/server/main.cpp @@ -1137,10 +1137,19 @@ int main(int argc, char* argv[]) if (!cfg_path.empty()) cfg = new config(cfg_path.c_str()); else - cfg = new config("./server.cfg"); - - logger = new logtofile(cfg->log_path().c_str()); - dos_logger = new logtofile(cfg->dos_log_path().c_str()); + cfg = new config; + if(!cfg->log_path().empty()) + logger = new logtofile(cfg->log_path().c_str()); + else + logger = new logtofile; + if(!cfg->dos_log_path().empty()) + dos_logger = new logtofile(cfg->dos_log_path().c_str()); + else + { + std::string cfg_path = boost::filesystem::initial_path().string(); + cfg_path += "/server.log"; + dos_logger = new logtofile(cfg_path.c_str()); + } while(true) { try |