Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
sirdabalot

Log file API - Updated to export CSV files ( view logs in excel/calc )

Recommended Posts

Hello, everyone!

 

As an opencomputers refresher after a long break from minecraft I've made a log file API.

 

It currently offers:

  1. Its own interpreter ( included in repo, this thing is pretty darn tweakable )
  2. A WPF interpreter ( more pretty than the one above )
  3. An OOP structure
  4. Exceptionally easy entry creation / filtration / saving / loading
  5. EVERYTHING is open source ( including WPF app )
  6. NEW: Both interpreters can export logs as CSV files for use in MS excel and Open/Libre Office Calc

 

A link to the repo: https://github.com/sirdabalot/OCLOGAPI

(All documentation in the API code)

 

Sample program for creating a log file:

require("logapi")
term = require("term")

newlog = logContainer( )

for i = 1, 10 do
	newlog:addEntry( entry( nil,string.rep( "test" .. i, 20), i + 1 ) )
end

newlog:save("testser.log")

Sample program for reading a log file:

require( "logapi" )
term = require( "term" )

newlog = logContainer( )

newlog:loadFrom("testser.log")

for k, v in ipairs ( newlog.entries ) do
	term.write( v.timedatestamp .. "#" .. v.info .. "#" .. v.priority .. "\n")
end

for k, v in ipairs ( newlog:findEntriesByPriority( "5" ) ) do
	term.write( v:serialize() )
end

And of course I had best throw in some semi-pretty pictures:

 

MbEDz63.jpg

 

I2kb08d.jpg3S8icrJ.jpg

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.