Jump to content
Sparker

[Intercept] Arma-ofstream - text output to multiple log files

Recommended Posts

Hi there!

 

This tiny Intercept-based addon adds two SQF commands to output data to files in text mode. You can open a file and write data to it. That's it for now!

 

Usage examples:

g_myRpt = ofstream_new "myRpt.rpt"; // Opens a file and returns a handle to it
g_myRpt ofstream_write "Some text"; // Write some text to a previously opened file
g_myRpt << "Look, I can output text like in C++"; // '<<' is the same as 'ofstream_write'
(ofstream_new "myRpt.rpt") ofstream_write "Some text"; // We can also 'open' the file every time we want to write, the addon will handle that fine

// You should probably make yourself a macro like this:
// Uncomment to switch between output to external file and standard diag_log
// #define OFSTREAM_ENABLED
#ifdef OFSTREAM_ENABLED
  #define MY_LOG (ofstream_new "myModule.rpt") ofstream_write
#else
  #define MY_LOG diag_log
#endif

 

Download / Installation:

Files will be created in <ARMA ROOT>/Logs folder

Install to Arma root directory as a typical mod: https://github.com/Sparker95/ARMA-ofstream/releases

Also you will need the Intercept host addon, this will do: https://steamcommunity.com/sharedfiles/filedetails/?id=1645973522

And disable Battleye before launching Arma!

 

Source (to prove that It won't mine bitcoins):

https://github.com/Sparker95/ARMA-ofstream/blob/master/src/FileInterface.cpp

https://github.com/Sparker95/ARMA-ofstream/blob/master/src/FileInterface.h

 

Intercept is an amazing project which lets you interface C++ (and, I think, Python and Lua?) code with the RV engine: 

 

It's pretty easy to make a working addon (I did it from this template: https://github.com/intercept/intercept-plugin-template ) and I hope developers will use it more often!

  • Thanks 2

Share this post


Link to post
Share on other sites

Congratulations for this and thanks for sharing Sparker  !

 

Just to understand a little bit !because i 'm a total noob to languages etc,

it's generally as the Intercept: A library for writing Arma Addons in native C++ topic  about and exporting an .rpt when using this ?

Share this post


Link to post
Share on other sites

Thanks!

 

With this addon (this is why I initially made it) you will be able to write debug text information into different text files. By default you have only the diag_log command which writes data to single .rpt file. If there are too many components in your mission/addon design, reading output from many modules is very inconvenient, so you might want to redirect all the information, from, for instance, medical system, into a different file. The addon I've made lets you do that by adding more SQF commands to achieve this. There is no way to add a custom SQF command by default, but with the usage of the Intercept library it becomes possible.

 

I hope it answers your question? If not, I'm sorry, I didn't quite understand what you mean.

  • Thanks 1

Share this post


Link to post
Share on other sites
19 minutes ago, Sparker said:

I hope it answers your question?

 

Yes and thank you very much for the reply Sparker and keep  up the good work !  :thumbs-up:

  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×