2021-09-12 04:32:14 +02:00
|
|
|
/*
|
2021-10-04 21:59:10 +02:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2021-09-12 04:32:14 +02:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#include <stratosphere.hpp>
|
|
|
|
#include "lm_log_getter.hpp"
|
|
|
|
#include "lm_log_getter_impl.hpp"
|
|
|
|
|
|
|
|
namespace ams::lm::srv {
|
|
|
|
|
|
|
|
extern bool g_is_logging_to_custom_sink;
|
|
|
|
|
|
|
|
Result LogGetter::StartLogging() {
|
|
|
|
g_is_logging_to_custom_sink = true;
|
2022-03-26 08:14:36 +01:00
|
|
|
R_SUCCEED();
|
2021-09-12 04:32:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Result LogGetter::StopLogging() {
|
|
|
|
g_is_logging_to_custom_sink = false;
|
2022-03-26 08:14:36 +01:00
|
|
|
R_SUCCEED();
|
2021-09-12 04:32:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Result LogGetter::GetLog(const sf::OutAutoSelectBuffer &message, sf::Out<s64> out_size, sf::Out<u32> out_drop_count) {
|
|
|
|
/* Try to flush logs. */
|
|
|
|
if (LogGetterImpl::GetBuffer().TryFlush()) {
|
|
|
|
*out_size = LogGetterImpl::GetLog(message.GetPointer(), message.GetSize(), out_drop_count.GetPointer());
|
|
|
|
} else {
|
|
|
|
/* Otherwise, we got no data. */
|
|
|
|
*out_size = 0;
|
|
|
|
}
|
|
|
|
|
2022-03-26 08:14:36 +01:00
|
|
|
R_SUCCEED();
|
2021-09-12 04:32:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|