Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
msupernaw committed May 7, 2024
1 parent 1f36ce0 commit 8cfe6ab
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 28 deletions.
6 changes: 3 additions & 3 deletions inst/include/interface/rcpp/rcpp_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,14 @@ void InitLogging(){
* Add log info entry from R.
*/
void LogInfo(std::string log_entry){
FIMSLog::fims_log->message(log_entry, -999, "R_env", "R_script_entry");
FIMSLog::fims_log->message(log_entry, -1, "R_env", "R_script_entry");
}

/**
* Add log warning entry from R.
*/
void LogWarning(std::string log_entry){
FIMSLog::fims_log->warning_message(log_entry, -999, "R_env", "R_script_entry");
FIMSLog::fims_log->warning_message(log_entry, -1, "R_env", "R_script_entry");
}

/**
Expand Down Expand Up @@ -160,7 +160,7 @@ void LogError(std::string log_entry){
// Rcpp::Environment base = Rcpp::Environment::global_env();
// Rcpp::Function f = base["traceback"];
// std::string ret = Rcpp::as<std::string>(f());
FIMSLog::fims_log->error_message(log_entry, -999, "R_env", ret.c_str());
FIMSLog::fims_log->error_message(log_entry, -1, "R_env", ret.c_str());
}

/**
Expand Down
63 changes: 38 additions & 25 deletions test/fims.log
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[
{
"timestamp" : "Mon May 6 11:32:19 2024",
"timestamp" : "Tue May 7 13:13:23 2024",
"level" : "info",
"message" : "Initializing FIMS logging system.",
"id" : "0",
Expand All @@ -11,113 +11,126 @@
"line" : "108"
},
{
"timestamp" : "Mon May 6 11:32:20 2024",
"timestamp" : "Tue May 7 13:13:23 2024",
"level" : "info",
"message" : "CreateModel: 2 instantiated model objects.",
"message" : "Setting FIMS write log: 1",
"id" : "1",
"user" : "mattadmin",
"wd" : "/Users/mattadmin/ModularTMBExample/logging-refactor/ModularTMBExample/test",
"file" : "./../inst/include/interface/rcpp/rcpp_interface.hpp",
"routine" : "void WriteLog(bool)",
"line" : "85"
},
{
"timestamp" : "Tue May 7 13:13:23 2024",
"level" : "info",
"message" : "CreateModel: 2 instantiated model objects.",
"id" : "2",
"user" : "mattadmin",
"wd" : "/Users/mattadmin/ModularTMBExample/logging-refactor/ModularTMBExample/test",
"file" : "./../inst/include/interface/rcpp/rcpp_interface.hpp",
"routine" : "bool CreateModel()",
"line" : "11"
},
{
"timestamp" : "Mon May 6 11:32:20 2024",
"timestamp" : "Tue May 7 13:13:23 2024",
"level" : "info",
"message" : "vonBertalanffyInterface::prepare.",
"id" : "2",
"id" : "3",
"user" : "mattadmin",
"wd" : "/Users/mattadmin/ModularTMBExample/logging-refactor/ModularTMBExample/test",
"file" : "./../inst/include/interface/rcpp/rcpp_objects/rcpp_growth.hpp",
"routine" : "virtual bool vonBertalanffyInterface::prepare()",
"line" : "106"
},
{
"timestamp" : "Mon May 6 11:32:20 2024",
"timestamp" : "Tue May 7 13:13:23 2024",
"level" : "info",
"message" : "vonBertalanffyInterface::prepare_local.",
"id" : "3",
"id" : "4",
"user" : "mattadmin",
"wd" : "/Users/mattadmin/ModularTMBExample/logging-refactor/ModularTMBExample/test",
"file" : "./../inst/include/interface/rcpp/rcpp_objects/rcpp_growth.hpp",
"routine" : "bool vonBertalanffyInterface::prepare_local() [Type = double]",
"line" : "54"
},
{
"timestamp" : "Mon May 6 11:32:20 2024",
"timestamp" : "Tue May 7 13:13:23 2024",
"level" : "info",
"message" : "vonBertalanffyInterface::prepare_local.",
"id" : "4",
"id" : "5",
"user" : "mattadmin",
"wd" : "/Users/mattadmin/ModularTMBExample/logging-refactor/ModularTMBExample/test",
"file" : "./../inst/include/interface/rcpp/rcpp_objects/rcpp_growth.hpp",
"routine" : "bool vonBertalanffyInterface::prepare_local() [Type = CppAD::AD<double>]",
"line" : "54"
},
{
"timestamp" : "Mon May 6 11:32:20 2024",
"timestamp" : "Tue May 7 13:13:23 2024",
"level" : "info",
"message" : "vonBertalanffyInterface::prepare_local.",
"id" : "5",
"id" : "6",
"user" : "mattadmin",
"wd" : "/Users/mattadmin/ModularTMBExample/logging-refactor/ModularTMBExample/test",
"file" : "./../inst/include/interface/rcpp/rcpp_objects/rcpp_growth.hpp",
"routine" : "bool vonBertalanffyInterface::prepare_local() [Type = CppAD::AD<CppAD::AD<double>>]",
"line" : "54"
},
{
"timestamp" : "Mon May 6 11:32:20 2024",
"timestamp" : "Tue May 7 13:13:23 2024",
"level" : "info",
"message" : "vonBertalanffyInterface::prepare_local.",
"id" : "6",
"id" : "7",
"user" : "mattadmin",
"wd" : "/Users/mattadmin/ModularTMBExample/logging-refactor/ModularTMBExample/test",
"file" : "./../inst/include/interface/rcpp/rcpp_objects/rcpp_growth.hpp",
"routine" : "bool vonBertalanffyInterface::prepare_local() [Type = CppAD::AD<CppAD::AD<CppAD::AD<double>>>]",
"line" : "54"
},
{
"timestamp" : "Mon May 6 11:32:20 2024",
"timestamp" : "Tue May 7 13:13:23 2024",
"level" : "info",
"message" : "vonBertalanffyInterface::finalize.",
"id" : "7",
"id" : "8",
"user" : "mattadmin",
"wd" : "/Users/mattadmin/ModularTMBExample/logging-refactor/ModularTMBExample/test",
"file" : "./../inst/include/interface/rcpp/rcpp_objects/rcpp_growth.hpp",
"routine" : "void vonBertalanffyInterface::finalize(Rcpp::NumericVector)",
"line" : "123"
},
{
"timestamp" : "Mon May 6 11:32:20 2024",
"timestamp" : "Tue May 7 13:13:23 2024",
"level" : "info",
"message" : "test info callback",
"id" : "8",
"id" : "9",
"user" : "mattadmin",
"wd" : "/Users/mattadmin/ModularTMBExample/logging-refactor/ModularTMBExample/test",
"file" : "R_callback",
"file" : "R_env",
"routine" : "R_script_entry",
"line" : "-999"
},
{
"timestamp" : "Mon May 6 11:32:20 2024",
"timestamp" : "Tue May 7 13:13:23 2024",
"level" : "warning",
"message" : "test warning callback",
"id" : "9",
"id" : "10",
"user" : "mattadmin",
"wd" : "/Users/mattadmin/ModularTMBExample/logging-refactor/ModularTMBExample/test",
"file" : "R_callback",
"file" : "R_env",
"routine" : "R_script_entry",
"line" : "-999"
},
{
"timestamp" : "Mon May 6 11:32:20 2024",
"timestamp" : "Tue May 7 13:13:23 2024",
"level" : "error",
"message" : "test error callback",
"id" : "10",
"id" : "11",
"user" : "mattadmin",
"wd" : "/Users/mattadmin/ModularTMBExample/logging-refactor/ModularTMBExample/test",
"file" : "R_callback",
"routine" : "R_script_entry",
"file" : "R_env",
"routine" : "traceback:
No traceback available
",
"line" : "-999"
}
]

0 comments on commit 8cfe6ab

Please sign in to comment.