-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1038 from kuzudb/logger-level-option
add logger-level option
- Loading branch information
Showing
14 changed files
with
153 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include "spdlog/spdlog.h" | ||
|
||
using namespace std; | ||
|
||
namespace kuzu { | ||
namespace common { | ||
|
||
class LoggingLevelUtils { | ||
public: | ||
static spdlog::level::level_enum convertStrToLevelEnum(string loggingLevel); | ||
|
||
static string convertLevelEnumToStr(spdlog::level::level_enum levelEnum); | ||
}; | ||
|
||
} // namespace common | ||
} // namespace kuzu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include "src/common/include/logging_level_utils.h" | ||
|
||
#include "src/common/include/utils.h" | ||
|
||
namespace kuzu { | ||
namespace common { | ||
|
||
spdlog::level::level_enum LoggingLevelUtils::convertStrToLevelEnum(string loggingLevel) { | ||
StringUtils::toLower(loggingLevel); | ||
if (loggingLevel == "info") { | ||
return spdlog::level::level_enum::info; | ||
} else if (loggingLevel == "debug") { | ||
return spdlog::level::level_enum::debug; | ||
} else if (loggingLevel == "err") { | ||
return spdlog::level::level_enum::err; | ||
} | ||
throw ConversionException( | ||
StringUtils::string_format("Unsupported logging level: %s.", loggingLevel.c_str())); | ||
} | ||
|
||
string LoggingLevelUtils::convertLevelEnumToStr(spdlog::level::level_enum levelEnum) { | ||
switch (levelEnum) { | ||
case spdlog::level::level_enum::trace: { | ||
return "trace"; | ||
} | ||
case spdlog::level::level_enum::debug: { | ||
return "debug"; | ||
} | ||
case spdlog::level::level_enum::info: { | ||
return "info"; | ||
} | ||
case spdlog::level::level_enum::warn: { | ||
return "warn"; | ||
} | ||
case spdlog::level::level_enum::err: { | ||
return "err"; | ||
} | ||
case spdlog::level::level_enum::critical: { | ||
return "critical"; | ||
} | ||
case spdlog::level::level_enum::off: { | ||
return "off"; | ||
} | ||
default: | ||
assert(false); | ||
} | ||
} | ||
|
||
} // namespace common | ||
} // namespace kuzu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
from tools.python_api import _kuzu as gdb | ||
from tools.python_api import _kuzu as kuzu | ||
|
||
|
||
databaseDir = "path_to_serialized_database" | ||
db = gdb.database(databaseDir) | ||
conn = gdb.connection(db) | ||
databaseDir = "path to database file" | ||
db = kuzu.database(databaseDir) | ||
conn = kuzu.connection(db) | ||
query = "MATCH (a:person) RETURN *;" | ||
result = conn.query(query) | ||
result = conn.execute(query) | ||
while result.hasNext(): | ||
print(result.getNext()) | ||
result.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters