This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed CRLF line separators on logger files and add .gitattributes f…
…ile. (#41)
- Loading branch information
1 parent
015c2b1
commit 8e37256
Showing
3 changed files
with
265 additions
and
246 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Set the default behavior, in case people don't have core.autocrlf set. | ||
* text=auto | ||
|
||
# Explicitly declare text files you want to always be normalized and converted | ||
# to native line endings on checkout. | ||
*.c text | ||
*.cc text | ||
*.cpp text | ||
*.h text | ||
*.txt text | ||
*.md text | ||
*.yml text | ||
*.sh text | ||
*.cmake text | ||
*.py text | ||
|
||
# Denote all files that are truly binary and should not be modified. | ||
*.png binary | ||
*.jpg binary |
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,105 +1,105 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Peloton | ||
// | ||
// logger.cpp | ||
// | ||
// Identification: src/common/logger.cpp | ||
// | ||
// Copyright (c) 2015-16, Carnegie Mellon University Database Group | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "common/logger.h" | ||
|
||
// #include "common/internal_types.h" | ||
#include "easylogging++/easylogging++.h" | ||
// #include "settings/settings_manager.h" | ||
|
||
// Initialize for Easylogging++ library | ||
INITIALIZE_EASYLOGGINGPP | ||
|
||
namespace terrier { | ||
|
||
/* @brief Initialize Peloton logger to set Easylogging++ according to settings | ||
*/ | ||
void Logger::InitializeLogger() { | ||
el::Configurations logger_conf; | ||
logger_conf.setToDefault(); | ||
|
||
// log flush threshold | ||
logger_conf.set(el::Level::Global, | ||
el::ConfigurationType::LogFlushThreshold, | ||
LOG_FLUSH_THERESHOLD); | ||
|
||
// log format setting | ||
logger_conf.set(el::Level::Global, | ||
el::ConfigurationType::Format, | ||
LOG_FORMAT); | ||
|
||
/* | ||
* ToDo: Need settings_manager and internal_types to set log level on booting | ||
* | ||
// standard output setting | ||
logger_conf.set(el::Level::Global, | ||
el::ConfigurationType::ToStandardOutput, | ||
settings::SettingsManager::GetString( | ||
settings::SettingId::log_to_standard_output)); | ||
// file output setting | ||
logger_conf.set(el::Level::Global, | ||
el::ConfigurationType::ToFile, | ||
settings::SettingsManager::GetString( | ||
settings::SettingId::log_to_file)); | ||
if (settings::SettingsManager::GetBool(settings::SettingId::log_to_file)) { | ||
// file path setting | ||
logger_conf.set(el::Level::Global, | ||
el::ConfigurationType::Filename, | ||
settings::SettingsManager::GetString( | ||
settings::SettingId::log_file_path)); | ||
} | ||
// log level setting for Easylogging++ by log_level setting parameter in Peloton | ||
auto log_level = StringToPelotonLogLevel( | ||
settings::SettingsManager::GetString(settings::SettingId::log_level)); | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Peloton | ||
// | ||
// logger.cpp | ||
// | ||
// Identification: src/common/logger.cpp | ||
// | ||
// Copyright (c) 2015-16, Carnegie Mellon University Database Group | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "common/logger.h" | ||
|
||
// #include "common/internal_types.h" | ||
#include "easylogging++/easylogging++.h" | ||
// #include "settings/settings_manager.h" | ||
|
||
// Initialize for Easylogging++ library | ||
INITIALIZE_EASYLOGGINGPP | ||
|
||
namespace terrier { | ||
|
||
/* @brief Initialize Peloton logger to set Easylogging++ according to settings | ||
*/ | ||
void Logger::InitializeLogger() { | ||
el::Configurations logger_conf; | ||
logger_conf.setToDefault(); | ||
|
||
// log flush threshold | ||
logger_conf.set(el::Level::Global, | ||
el::ConfigurationType::LogFlushThreshold, | ||
LOG_FLUSH_THERESHOLD); | ||
|
||
// log format setting | ||
logger_conf.set(el::Level::Global, | ||
el::ConfigurationType::Format, | ||
LOG_FORMAT); | ||
|
||
/* | ||
* ToDo: Need settings_manager and internal_types to set log level on booting | ||
* | ||
// standard output setting | ||
logger_conf.set(el::Level::Global, | ||
el::ConfigurationType::ToStandardOutput, | ||
settings::SettingsManager::GetString( | ||
settings::SettingId::log_to_standard_output)); | ||
// file output setting | ||
logger_conf.set(el::Level::Global, | ||
el::ConfigurationType::ToFile, | ||
settings::SettingsManager::GetString( | ||
settings::SettingId::log_to_file)); | ||
if (settings::SettingsManager::GetBool(settings::SettingId::log_to_file)) { | ||
// file path setting | ||
logger_conf.set(el::Level::Global, | ||
el::ConfigurationType::Filename, | ||
settings::SettingsManager::GetString( | ||
settings::SettingId::log_file_path)); | ||
} | ||
// log level setting for Easylogging++ by log_level setting parameter in Peloton | ||
auto log_level = StringToPelotonLogLevel( | ||
settings::SettingsManager::GetString(settings::SettingId::log_level)); | ||
switch (log_level) { | ||
case PelotonLogLevel::ERROR: | ||
logger_conf.set(el::Level::Warning, | ||
el::ConfigurationType::Enabled, | ||
"false"); | ||
// no break | ||
case PelotonLogLevel::WARN: | ||
logger_conf.set(el::Level::Info, | ||
el::ConfigurationType::Enabled, | ||
"false"); | ||
// no break | ||
case PelotonLogLevel::INFO: | ||
logger_conf.set(el::Level::Debug, | ||
el::ConfigurationType::Enabled, | ||
"false"); | ||
// no break | ||
case PelotonLogLevel::DEBUG: | ||
logger_conf.set(el::Level::Trace, | ||
el::ConfigurationType::Enabled, | ||
"false"); | ||
// no break | ||
case PelotonLogLevel::TRACE: | ||
// enable all log levels | ||
break; | ||
default: { | ||
throw Exception(StringUtil::Format( | ||
"Invalid Peloton log level appears '%s'", | ||
PelotonLogLevelToString(log_level).c_str())); | ||
} | ||
} | ||
*/ | ||
|
||
// apply the logger configuration | ||
el::Loggers::reconfigureLogger(LOGGER_NAME, logger_conf); | ||
} | ||
|
||
} | ||
|
||
|
||
case PelotonLogLevel::ERROR: | ||
logger_conf.set(el::Level::Warning, | ||
el::ConfigurationType::Enabled, | ||
"false"); | ||
// no break | ||
case PelotonLogLevel::WARN: | ||
logger_conf.set(el::Level::Info, | ||
el::ConfigurationType::Enabled, | ||
"false"); | ||
// no break | ||
case PelotonLogLevel::INFO: | ||
logger_conf.set(el::Level::Debug, | ||
el::ConfigurationType::Enabled, | ||
"false"); | ||
// no break | ||
case PelotonLogLevel::DEBUG: | ||
logger_conf.set(el::Level::Trace, | ||
el::ConfigurationType::Enabled, | ||
"false"); | ||
// no break | ||
case PelotonLogLevel::TRACE: | ||
// enable all log levels | ||
break; | ||
default: { | ||
throw Exception(StringUtil::Format( | ||
"Invalid Peloton log level appears '%s'", | ||
PelotonLogLevelToString(log_level).c_str())); | ||
} | ||
} | ||
*/ | ||
|
||
// apply the logger configuration | ||
el::Loggers::reconfigureLogger(LOGGER_NAME, logger_conf); | ||
} | ||
|
||
} | ||
|
||
|
Oops, something went wrong.