File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ namespace session::nodeapi {
1616class ConfigBaseImpl ;
1717template <typename T>
1818inline constexpr bool is_derived_napi_wrapper =
19- std::is_base_of_v<ConfigBaseImpl, T>&& std::is_base_of_v<Napi::ObjectWrap<T>, T>;
19+ std::is_base_of_v<ConfigBaseImpl, T> && std::is_base_of_v<Napi::ObjectWrap<T>, T>;
2020
2121// / Base implementation class for config types; this provides the napi wrappers for the base
2222// / methods. Subclasses should inherit from this (alongside Napi::ObjectWrap<ConfigBaseWrapper>)
@@ -100,7 +100,24 @@ class ConfigBaseImpl {
100100 if (!second.IsEmpty () && !second.IsNull () && !second.IsUndefined ())
101101 dump = toCppBufferView (second, class_name + " .new" );
102102
103- return std::make_shared<Config>(secretKey, dump);
103+ // return std::make_shared<Config>(secretKey, dump);
104+ std::shared_ptr<Config> config = std::make_shared<Config>(secretKey, dump);
105+
106+ Napi::Env env = info.Env ();
107+
108+ config->logger = [env, class_name](session::config::LogLevel, std::string_view x) {
109+ std::string toLog =
110+ " libsession-util:" + std::string (class_name) + " : " + std::string (x) + " \n " ;
111+
112+ Napi::Function consoleLog = env.Global ()
113+ .Get (" console" )
114+ .As <Napi::Object>()
115+ .Get (" log" )
116+ .As <Napi::Function>();
117+ consoleLog.Call ({Napi::String::New (env, toLog)});
118+ };
119+
120+ return config;
104121 });
105122 }
106123
You can’t perform that action at this time.
0 commit comments