Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Removed CRLF line separators on logger files and add .gitattributes f…
Browse files Browse the repository at this point in the history
…ile. (#41)
  • Loading branch information
mbutrovich authored Jul 31, 2018
1 parent 015c2b1 commit 8e37256
Show file tree
Hide file tree
Showing 3 changed files with 265 additions and 246 deletions.
19 changes: 19 additions & 0 deletions .gitattributes
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
208 changes: 104 additions & 104 deletions src/common/logger.cpp
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);
}

}


Loading

0 comments on commit 8e37256

Please sign in to comment.