@@ -20,24 +20,24 @@ EngineInitCmd::EngineInitCmd(std::string engineName, std::string version)
2020
2121bool EngineInitCmd::Exec () const {
2222 if (engineName_.empty ()) {
23- LOG_ERROR << " Engine name is required" ;
23+ CTL_ERR ( " Engine name is required" ) ;
2424 return false ;
2525 }
2626
2727 // Check if the architecture and OS are supported
2828 auto system_info = system_info_utils::GetSystemInfo ();
2929 if (system_info.arch == system_info_utils::kUnsupported ||
3030 system_info.os == system_info_utils::kUnsupported ) {
31- LOG_ERROR << " Unsupported OS or architecture: " << system_info.os << " , "
32- << system_info.arch ;
31+ CTL_ERR ( " Unsupported OS or architecture: " << system_info.os << " , "
32+ << system_info.arch ) ;
3333 return false ;
3434 }
35- LOG_INFO << " OS: " << system_info.os << " , Arch: " << system_info.arch ;
35+ CTL_INF ( " OS: " << system_info.os << " , Arch: " << system_info.arch ) ;
3636
3737 // check if engine is supported
3838 if (std::find (supportedEngines_.begin (), supportedEngines_.end (),
3939 engineName_) == supportedEngines_.end ()) {
40- LOG_ERROR << " Engine not supported" ;
40+ CTL_ERR ( " Engine not supported" ) ;
4141 return false ;
4242 }
4343
@@ -46,7 +46,7 @@ bool EngineInitCmd::Exec() const {
4646 std::ostringstream engineReleasePath;
4747 engineReleasePath << " /repos/janhq/" << engineName_ << " /releases/"
4848 << version;
49- LOG_INFO << " Engine release path: " << gitHubHost << engineReleasePath.str ();
49+ CTL_INF ( " Engine release path: " << gitHubHost << engineReleasePath.str () );
5050 using namespace nlohmann ;
5151
5252 httplib::Client cli (gitHubHost);
@@ -64,10 +64,10 @@ bool EngineInitCmd::Exec() const {
6464 }
6565
6666 auto cuda_driver_version = system_info_utils::GetCudaVersion ();
67- LOG_INFO << " Engine: " << engineName_
68- << " , CUDA driver version: " << cuda_driver_version;
67+ CTL_INF (" engineName_: " << engineName_);
68+ CTL_INF (" CUDA version: " << cuda_driver_version);
69+ std::string matched_variant = " " ;
6970
70- std::string matched_variant{" " };
7171 if (engineName_ == " cortex.tensorrt-llm" ) {
7272 matched_variant = engine_matcher_utils::ValidateTensorrtLlm (
7373 variants, system_info.os , cuda_driver_version);
@@ -80,9 +80,9 @@ bool EngineInitCmd::Exec() const {
8080 variants, system_info.os , system_info.arch , suitable_avx,
8181 cuda_driver_version);
8282 }
83- LOG_INFO << " Matched variant: " << matched_variant;
83+ CTL_INF ( " Matched variant: " << matched_variant) ;
8484 if (matched_variant.empty ()) {
85- LOG_ERROR << " No variant found for " << os_arch;
85+ CTL_ERR ( " No variant found for " << os_arch) ;
8686 return false ;
8787 }
8888
@@ -95,7 +95,7 @@ bool EngineInitCmd::Exec() const {
9595 std::string path = full_url.substr (host.length ());
9696
9797 auto fileName = asset[" name" ].get <std::string>();
98- LOG_INFO << " URL: " << full_url;
98+ CTL_INF ( " URL: " << full_url) ;
9999
100100 auto downloadTask = DownloadTask{.id = engineName_,
101101 .type = DownloadType::Engine,
@@ -115,8 +115,8 @@ bool EngineInitCmd::Exec() const {
115115 bool unused) {
116116 // try to unzip the downloaded file
117117 std::filesystem::path downloadedEnginePath{absolute_path};
118- LOG_INFO << " Downloaded engine path: "
119- << downloadedEnginePath.string ();
118+ CTL_INF (
119+ " Downloaded engine path: " << downloadedEnginePath.string () );
120120
121121 std::filesystem::path extract_path =
122122 downloadedEnginePath.parent_path ().parent_path ();
@@ -156,9 +156,9 @@ bool EngineInitCmd::Exec() const {
156156 try {
157157 std::filesystem::remove (absolute_path);
158158 } catch (const std::exception& e) {
159- LOG_ERROR << " Could not delete file: " << e.what ();
159+ CTL_WRN ( " Could not delete file: " << e.what () );
160160 }
161- LOG_INFO << " Finished!" ;
161+ CTL_INF ( " Finished!" ) ;
162162 });
163163 if (system_info.os == " mac" || engineName_ == " cortex.onnx" ) {
164164 // mac and onnx engine does not require cuda toolkit
@@ -192,9 +192,9 @@ bool EngineInitCmd::Exec() const {
192192 // cuda driver version should be greater than toolkit version to ensure compatibility
193193 if (semantic_version_utils::CompareSemanticVersion (
194194 cuda_driver_version, suitable_toolkit_version) < 0 ) {
195- LOG_ERROR << " Your Cuda driver version " << cuda_driver_version
195+ CTL_ERR ( " Your Cuda driver version " << cuda_driver_version
196196 << " is not compatible with cuda toolkit version "
197- << suitable_toolkit_version;
197+ << suitable_toolkit_version) ;
198198 return false ;
199199 }
200200
@@ -233,7 +233,7 @@ bool EngineInitCmd::Exec() const {
233233 try {
234234 std::filesystem::remove (absolute_path);
235235 } catch (std::exception& e) {
236- LOG_ERROR << " Error removing downloaded file: " << e.what ();
236+ CTL_ERR ( " Error removing downloaded file: " << e.what () );
237237 }
238238 });
239239
@@ -245,12 +245,12 @@ bool EngineInitCmd::Exec() const {
245245 return false ;
246246 }
247247 } else {
248- LOG_ERROR << " HTTP error: " << res->status ;
248+ CTL_ERR ( " HTTP error: " << res->status ) ;
249249 return false ;
250250 }
251251 } else {
252252 auto err = res.error ();
253- LOG_ERROR << " HTTP error: " << httplib::to_string (err);
253+ CTL_ERR ( " HTTP error: " << httplib::to_string (err) );
254254 return false ;
255255 }
256256 return true ;
0 commit comments