This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Exerro's profile picture

File addon - Save a file log, view file info and edit a files config

Started by Exerro, 17 February 2013 - 11:35 PM
Exerro #1
Posted 18 February 2013 - 12:35 AM
What does this program do?

-Saves a log of things that happened while the program was running
-Saves how long the program was running
-Saves how many times the program has been run
-Adds options for what to save/exclude from the log & info
-Does all this in the same file as the code, without messing around with the code or adding any unwanted extras ( apart from a little '^' in the bottom left to quit the program ( uses "terminate" so you can stop it ) )
-Adds a try( functionname, function, …args ) function that will not error( ) ( uses pcall and logs errors )
-Adds a log.add( type, …data ) function to add things to program log


Why?
Usually to make a log or get info about a program you have to create loads of other API's and files to save the information that makes you wish you had never started. This does it all for you

Still to come:
Screenshotting
Only running with certain args
Logging new functions, new variables, if statements etc ( will be able to disable these individually )
Finishing term library rewrite
New options in the info section


Pastebin:
http://pastebin.com/cHqYRbrU

Example:
Code:
Spoiler



for i = 1,10 do
term.write( "hello" )
sleep( 0.1 )
term.clear( )
term.setCursorPos( 1, 1 )
end

After running:
Spoiler


--test was run
--[[[Info] = Information gathered while program was running
runtime = 0 days, 0 hours, 0 minutes, 1 seconds
times run = 1
]]
--[[[Properties] = File properties
Save Log=true
Exclude From Save Log=
Save running data=true
]]
--Code:

for i = 1,10 do
term.write( "hello" )
sleep( 0.1 )
term.clear( )
term.setCursorPos( 1, 1 )
end

--[[[Program Log] = Welcome to the program log
System - rewriting term library
System - Running program
Trying - shell.run with args: test
Screen - wrote hello at 1 3
Screen - cleared
Screen - Set cursor pos to 1 1
Screen - wrote hello at 1 1
Screen - cleared
Screen - Set cursor pos to 1 1
Screen - wrote hello at 1 1
Screen - cleared
Screen - Set cursor pos to 1 1
Screen - wrote hello at 1 1
Screen - cleared
Screen - Set cursor pos to 1 1
Screen - wrote hello at 1 1
Screen - cleared
Screen - Set cursor pos to 1 1
Screen - wrote hello at 1 1
Screen - cleared
Screen - Set cursor pos to 1 1
Screen - wrote hello at 1 1
Screen - cleared
Screen - Set cursor pos to 1 1
Screen - wrote hello at 1 1
Screen - cleared
Screen - Set cursor pos to 1 1
Screen - wrote hello at 1 1
Screen - cleared
Screen - Set cursor pos to 1 1
Screen - wrote hello at 1 1
Screen - cleared
Screen - Set cursor pos to 1 1
System - Saving Event Log
]]



Post any bugs or suggestions below please :D/>

When running the program type "run [run/clear/log] [program name]"
clear will change the program to the original without the extra stuff
run will run it
log will display the log
theoriginalbit #2
Posted 18 February 2013 - 12:40 AM
Very nice idea :)/> can i ask for a slightly smaller font size though please :)/>
Exerro #3
Posted 18 February 2013 - 12:45 AM
sure :)/> i just noticed your cc config program thing…hope mine doesn't rip it off or anything, sorry.
theoriginalbit #4
Posted 18 February 2013 - 01:10 AM
sure :)/> i just noticed your cc config program thing…hope mine doesn't rip it off or anything, sorry.
Nah its fine they are very different. :)/>

Yours I would call more of a logger. Mine is a Configuration File utility. so if you look at mine you have properties that the user can change and the next time your program loads it uses those, not the ones your program originally had. its like how Minecraft and all the mods works with the configs.
Yours is more a text version of a screen recorder, it just logs functions called and such. I do like it though, first of its kind that I've seen :)/>
Exerro #5
Posted 18 February 2013 - 01:24 AM
:D/> you can edit the config things and it does affect things…like you can add Screen to the exclude from log and it wont add in any logs that have the type: Screen ( all the term ones )…i'm currently making a screen recorder to go with this though, hopefully that will be better as it will get a log as well as a recording of the screen
theoriginalbit #6
Posted 18 February 2013 - 01:28 AM
Well yeh, but its a different type of config. its still a logger with in-bulit config… hmmm screen recorder :)/>
Exerro #7
Posted 18 February 2013 - 01:39 AM
Well yeh, but its a different type of config. its still a logger with in-bulit config… hmmm screen recorder :)/>
wow screen recorders are surprisingly hard…do you have any suggestions on how i should save each screen in a file…im thinking paint style with 3 sections for b-col t-col and text
theoriginalbit #8
Posted 18 February 2013 - 01:52 AM
wow screen recorders are surprisingly hard…do you have any suggestions on how i should save each screen in a file…im thinking paint style with 3 sections for b-col t-col and text
Thats really up to you as to how you do it, I do suggest not to use individual files for each screen though. use one file.