General Logging Util (stab) class for native errors (#31998)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31998

Overall Context: We want to add a way to log errors (e.g. mustfix, warn, etc on the server with stack trace) without crashing the app (e.g. react_native_assert crashes the app).

This diff: I am writing very simple logger functions which will get resolved at build time depending on the platforms/apps.

Changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D30174404

fbshipit-source-id: 2e5bc865dd8576c5a758c56e080a1e582a8c3ada
This commit is contained in:
Sota Ogo
2021-08-10 21:31:26 -07:00
committed by Facebook GitHub Bot
parent 83b16292ca
commit 307f54832d
6 changed files with 61 additions and 3 deletions
@@ -0,0 +1,29 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "ReactNativeLogger.h"
#include <glog/logging.h>
namespace facebook {
namespace react {
namespace ReactNativeLogger {
void info(std::string const &text) {
LOG(INFO) << text;
}
void warning(std::string const &text) {
LOG(WARNING) << text;
}
void error(std::string const &text) {
LOG(ERROR) << text;
}
} // namespace ReactNativeLogger
} // namespace react
} // namespace facebook