From b9646506afc678379a2b8ce2f52a0d3552ac5375 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 11 Oct 2014 12:57:13 +0200 Subject: reading debug level and module dir from config --- src/crawl/crawl.conf | 6 +++--- src/crawl/crawl.cpp | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/crawl/crawl.conf b/src/crawl/crawl.conf index 816f23f..8169ae1 100644 --- a/src/crawl/crawl.conf +++ b/src/crawl/crawl.conf @@ -1,16 +1,16 @@ --- global setting +-- global settings crawler = { -- stop after N documents stop_after_N_operations = 10, - module_path = modules, + module_path = "modules", modules_search_recursive = true } logger = { - level = DEBUG + level = "DEBUG" } -- seeds: URLS which are fed in the beginning to the URL frontier diff --git a/src/crawl/crawl.cpp b/src/crawl/crawl.cpp index e26de0a..5070c39 100755 --- a/src/crawl/crawl.cpp +++ b/src/crawl/crawl.cpp @@ -67,9 +67,8 @@ int main( int /* argc */, char *argv[] ) { try { LuaVM luaVm; - -// Logger::instance( ).openConsoleLog( logINFO ); - Logger::instance( ).openConsoleLog( logDEBUG ); + + //Logger::instance( ).openConsoleLog( logDEBUG ); // load configuration (Lua) and execute main (to // get basic configuration in form of global @@ -77,6 +76,9 @@ int main( int /* argc */, char *argv[] ) luaVm.loadSource( argv[1] ); luaVm.executeMain( ); + std::string logLevel = luaVm.getString( "logger.level" ); + Logger::instance( ).openConsoleLog( Logger::fromString( logLevel ) ); + #ifndef _WIN32 struct sigaction sa; memset( &sa, 0, sizeof( struct sigaction ) ); @@ -89,8 +91,9 @@ int main( int /* argc */, char *argv[] ) SetConsoleCtrlHandler( termHandler, TRUE ); #endif - // go through all type of modules and load them with the proper loader - LOG( logNOTICE ) << "Loading modules"; + // go through all type of modules and load them with the proper loader + string modulePath = luaVm.getString( "crawler.module_path" ); + LOG( logNOTICE ) << "Loading modules from path '" << modulePath << "'"; vector normalizerModules; #ifndef _WIN32 -- cgit v1.2.3-54-g00ecf