commented util.h

This commit is contained in:
jebes 2014-09-09 20:18:23 -04:00
parent bf972c40fc
commit c085e9294f
5 changed files with 102 additions and 44 deletions

View file

@ -29,7 +29,7 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
// node.cpp : Defines the entry point for the console application.
//
// Does this file exist?
#include "include_base_utils.h"
@ -64,11 +64,42 @@ namespace
const command_line::arg_descriptor<bool> arg_console = {"no-console", "Disable daemon console commands"};
}
bool command_line_preprocessor(const boost::program_options::variables_map& vm);
bool command_line_preprocessor(const boost::program_options::variables_map& vm)
{
bool exit = false;
if (command_line::get_arg(vm, command_line::arg_version))
{
std::cout << CRYPTONOTE_NAME << " v" << PROJECT_VERSION_LONG << ENDL;
exit = true;
}
if (command_line::get_arg(vm, arg_os_version))
{
std::cout << "OS: " << tools::get_os_version_string() << ENDL;
exit = true;
}
if (exit)
{
return true;
}
int new_log_level = command_line::get_arg(vm, arg_log_level);
if(new_log_level < LOG_LEVEL_MIN || new_log_level > LOG_LEVEL_MAX)
{
LOG_PRINT_L0("Wrong log level value: ");
}
else if (log_space::get_set_log_detalisation_level(false) != new_log_level)
{
log_space::get_set_log_detalisation_level(true, new_log_level);
LOG_PRINT_L0("LOG_LEVEL set to " << new_log_level);
}
return false;
}
int main(int argc, char* argv[])
{
string_tools::set_module_name_and_folder(argv[0]);
#ifdef WIN32
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
@ -235,35 +266,3 @@ int main(int argc, char* argv[])
CATCH_ENTRY_L0("main", 1);
}
bool command_line_preprocessor(const boost::program_options::variables_map& vm)
{
bool exit = false;
if (command_line::get_arg(vm, command_line::arg_version))
{
std::cout << CRYPTONOTE_NAME << " v" << PROJECT_VERSION_LONG << ENDL;
exit = true;
}
if (command_line::get_arg(vm, arg_os_version))
{
std::cout << "OS: " << tools::get_os_version_string() << ENDL;
exit = true;
}
if (exit)
{
return true;
}
int new_log_level = command_line::get_arg(vm, arg_log_level);
if(new_log_level < LOG_LEVEL_MIN || new_log_level > LOG_LEVEL_MAX)
{
LOG_PRINT_L0("Wrong log level value: ");
}
else if (log_space::get_set_log_detalisation_level(false) != new_log_level)
{
log_space::get_set_log_detalisation_level(true, new_log_level);
LOG_PRINT_L0("LOG_LEVEL set to " << new_log_level);
}
return false;
}

View file

@ -28,6 +28,8 @@
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
/* This isn't a header file, may want to refactor this... */
#pragma once
#include <boost/lexical_cast.hpp>
@ -39,7 +41,11 @@
#include "crypto/hash.h"
#include "version.h"
/*!
* \brief I don't really know right now
*
*
*/
class daemon_cmmands_handler
{
nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<cryptonote::core> >& m_srv;