From dcd3bd7e92ffa211a9d4456e58aaadad8913a0da Mon Sep 17 00:00:00 2001 From: masajiro Date: Wed, 6 Nov 2019 11:20:24 +0900 Subject: [PATCH] fix bugs of logging and C APIs --- VERSION | 2 +- lib/NGT/Capi.h | 6 +++--- lib/NGT/Common.h | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index 27f9cd3..a8fdfda 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.8.0 +1.8.1 diff --git a/lib/NGT/Capi.h b/lib/NGT/Capi.h index 6375e37..fb9edd2 100644 --- a/lib/NGT/Capi.h +++ b/lib/NGT/Capi.h @@ -136,8 +136,8 @@ const char *ngt_get_error_string(const NGTError); void ngt_clear_error_string(NGTError); void ngt_destroy_error_object(NGTError); - -NGTOptimizer ngt_create_optimizer(NGTError); + +NGTOptimizer ngt_create_optimizer(bool logDisabled, NGTError); bool ngt_optimizer_adjust_search_coefficients(NGTOptimizer, const char *, NGTError); @@ -146,7 +146,7 @@ bool ngt_optimizer_execute(NGTOptimizer, const char *, const char *, NGTError); bool ngt_optimizer_set(NGTOptimizer optimizer, int outgoing, int incoming, int nofqs, float baseAccuracyFrom, float baseAccuracyTo, float rateAccuracyFrom, float rateAccuracyTo, - double qte, double m, int log, NGTError error); + double qte, double m, NGTError error); void ngt_destroy_optimizer(NGTOptimizer); diff --git a/lib/NGT/Common.h b/lib/NGT/Common.h index 8d1d1a7..6ff31cf 100644 --- a/lib/NGT/Common.h +++ b/lib/NGT/Common.h @@ -241,10 +241,10 @@ namespace NGT { if (!enabled) { return; } - if (logFilePath != "/dev/null") { - logFD = open("log", O_WRONLY|O_APPEND, mode); + if (logFilePath == "/dev/null") { + logFD = open(logFilePath.c_str(), O_WRONLY|O_APPEND, mode); } else { - logFD = open("log", O_CREAT|O_WRONLY|O_APPEND, mode); + logFD = open(logFilePath.c_str(), O_CREAT|O_WRONLY|O_APPEND, mode); } if (logFD < 0) { std::cerr << "Logger: Cannot begin logging." << std::endl;