summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2014-10-11 12:57:13 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2014-10-11 12:57:13 +0200
commitb9646506afc678379a2b8ce2f52a0d3552ac5375 (patch)
tree727db94a77075d7a93b0d4097414a819bfefb375 /src
parenta613ebbe1b544a854645eda518e18ab3e91b75b6 (diff)
downloadcrawler-b9646506afc678379a2b8ce2f52a0d3552ac5375.tar.gz
crawler-b9646506afc678379a2b8ce2f52a0d3552ac5375.tar.bz2
reading debug level and module dir from config
Diffstat (limited to 'src')
-rw-r--r--src/crawl/crawl.conf6
-rwxr-xr-xsrc/crawl/crawl.cpp13
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<string> normalizerModules;
#ifndef _WIN32