Add logging controls to the API

Control verbosity and choose a file to output to.
This commit is contained in:
Oliver Hamlet
2017-02-06 18:03:17 +00:00
parent 5dae27ce87
commit f353cc7bda
4 changed files with 112 additions and 3 deletions
+24
View File
@@ -37,9 +37,33 @@
#include "loot/exception/game_detection_error.h"
#include "loot/exception/git_state_error.h"
#include "loot/enum/game_type.h"
#include "loot/enum/log_verbosity.h"
#include "loot/loot_version.h"
namespace loot {
/**@}*/
/**********************************************************************//**
* @name Logging Functions
*************************************************************************/
/**@{*/
/**
* @brief Set the API's logging verbosity.
* @details The default is ``LogVerbosity::off``.
* @param verbosity
* The logging verbosity to set.
*/
LOOT_API void SetLoggingVerbosity(LogVerbosity verbosity);
/**
* @brief Set the file path that logging statements are written to.
* @details If no file is set the default behaviour is to print logging
* statements to the console.
* @param path
* The log file path.
*/
LOOT_API void SetLogFile(const std::string& path);
/**@}*/
/**********************************************************************//**
* @name Version Functions
+48
View File
@@ -0,0 +1,48 @@
/* LOOT
A load order optimisation tool for Oblivion, Skyrim, Fallout 3 and
Fallout: New Vegas.
Copyright (C) 2012-2016 WrinklyNinja
This file is part of LOOT.
LOOT is free software: you can redistribute
it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
LOOT is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with LOOT. If not, see
<https://www.gnu.org/licenses/>.
*/
#ifndef LOOT_LOG_VERBOSITY
#define LOOT_LOG_VERBOSITY
/**
* The namespace used by the LOOT API.
*/
namespace loot {
/**
* @brief Codes used to specify the preferred language for messages when
* evaluating masterlists and userlists.
* @details If a message is not available in the preferred language, its English
* string will be used. Note that messages with only one language
* string are assumed to be written in English, but this cannot be
* guaranteed (any violations should be reported as bugs so that they
* can be fixed).
*/
enum struct LogVerbosity : unsigned int {
off,
warning,
trace,
};
}
#endif