supplierdeeply

Time Stamping The Time Lapse Log Files?

  • 1 Replies
  • 716 Views
Time Stamping The Time Lapse Log Files?
« on: 01 / July / 2013, 02:56:22 »
Advertisements
Hi
   My newbie question is:
Time stamping the time lapse log files?

My code writing skills are nill, it confuses me!  :blink:
   This F15.log isn't perfect but its much better than the logs I get with F16.
 At least the values are in columns even if they aren't aligned perfectly with the labels. The F16 code is much shorter than F15 and looks much simpler. Is that because all the work is being done in the lualib ,folder instead of the script itself?
    Is F15 code being more complicated why the logs look so different or maybe the header code?
Anyway it saves every log as "F15.log"' and I have to change the names manually when there are more than one in a day.
   What I would like is for the script to save the logs as the "Script Name" ie (F15.Log_.Date/Time)
I think I found the code but don't know where it goes so it works correctly. Can I add the same code to a different script so it will save a log or does it need to be specific to each script?
   Any help would be Greatly Appreciated!

Am I on the right track with any of these?

print_screen(os.date("%H%M"))
print(os.date())
--------------------------------------------------------
function restore()
  print_screen(2) -- closes LOG_0001.TXT so you can rename it
  os.rename("A/CHDK/LOGS/LOG_0001.TXT","A/CHDK/LOGS/"..os.date("%m%d%H%M")..".LOG")
end

print_screen(1)
print(os.date())

----------------------------------------------------------


logfile,msg=io:open("A/log"..log_id.."txt","wb")
if not logfile then
 error("couldn't open log file" .. msg)
end
-- ... loop with MD stuff
  logfile:write("MD ",n,":",os.date("%Y-%m-%d %H:%M:%S"),"\n")
-- ... MD loop
logifle:close()

-----------------------------------------------------------------------------

Re: Time Stamping The Time Lapse Log Files?
« Reply #1 on: 01 / July / 2013, 08:37:43 »
When asking quesitions about scripting,  its always a good idea to either post a link to the script you are using, or to post the actual script as an attachment to you post.  There are thousands of CHDK scripts out there - don't assume anyone knows what F15 or F16 does.

Having said that,  are you talking about the various "sunset" scripts?
http://chdk.setepontos.com/index.php?topic=3079.msg31644#msg31644

A quick look at your code snippets makes me think you are on the right track.  Try them and see?  Unlike uBASIC, Lua has pretty good error checking.  If it doesn't work, fix it and try again.  If you get really stumped, post specifics here about what happened when it did not work (what did you see).
« Last Edit: 01 / July / 2013, 08:39:57 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics