Skip to content

Commit

Permalink
replace 'function' with 'func'
Browse files Browse the repository at this point in the history
When accessing the element log[[i]]$function throws a error in R. Replaced element name with 'func'.
  • Loading branch information
msupernaw committed May 3, 2024
1 parent d464dca commit eb3f552
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion inst/include/common/fims_log.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct LogEntry {
ss << "\"user\" : " << "\"" << this->user << "\",\n";
ss << "\"wd\" : " << "\"" << this->wd << "\",\n";
ss << "\"file\" : " << "\"" << this->file << "\",\n";
ss << "\"function\" : " << "\"" << this->func << "\",\n";
ss << "\"func\" : " << "\"" << this->func << "\",\n";
ss << "\"line\" : " << "\"" << this->line << "\"\n";
return ss.str();
}
Expand Down
20 changes: 20 additions & 0 deletions test/test.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
library(TMB)
library(Rcpp)
library(ModularTMBExample)
library(jsonlite)


#get the Rcpp module
g<-Rcpp::Module(module = "growth",PACKAGE = "ModularTMBExample")
Expand Down Expand Up @@ -82,3 +84,21 @@ obj$report()
print("final gradient:")
print(rep$gradient.fixed)
cat(g$GetLog())


fims_log<-fromJSON(g$GetLog(),simplifyVector = FALSE)
for(i in 1:length(fims_log)){
print(fims_log[[i]])
}

for(i in 1:length(fims_log)){
print(fims_log[[i]]$user)
print(fims_log[[i]]$timestamp)
print(fims_log[[i]]$id)
print(fims_log[[i]]$level)
print(fims_log[[i]]$message)
print(fims_log[[i]]$line)
print(fims_log[[i]]$file)
print(fims_log[[i]]$func)
cat("\n\n")
}

0 comments on commit eb3f552

Please sign in to comment.