浏览代码

Suppress console log output for library use, enclose Platform in try-catch

Still need to suppress global::cerr and global::cout
Tatsuhiro Tsujikawa 12 年之前
父节点
当前提交
315c05ea3c
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      src/aria2api.cc

+ 7 - 1
src/aria2api.cc

@@ -72,7 +72,13 @@ Platform* platform = 0;
 
 int libraryInit()
 {
-  platform = new Platform();
+  try {
+    platform = new Platform();
+  } catch(RecoverableException& e) {
+    A2_LOG_ERROR_EX(EX_EXCEPTION_CAUGHT, e);
+    return -1;
+  }
+  LogFactory::setConsoleOutput(false);
   return 0;
 }