Add some information in log - Script Writing - CHDK Forum supplierdeeply

Add some information in log

  • 2 Replies
  • 2300 Views
Add some information in log
« on: 26 / February / 2021, 04:48:39 »
Advertisements
Hi!

Starting from the script rawopint I try to put more information on the log csv. I want to write a keyword like and string for a processing in pyhton later and write the names of the photos that been taked.

Anybody has an idea how I write this?

Thanks!

*

Offline reyalp

  • ******
  • 14117
Re: Add some information in log
« Reply #1 on: 26 / February / 2021, 12:57:00 »
Starting from the script rawopint I try to put more information on the log csv. I want to write a keyword like and string for a processing in pyhton later and write the names of the photos that been taked.
Where does the string you want to write come from? Is it generated in the script itself, or do you want to somehow input it?

Adding to the log from the script is easy:
You can use logdesc add to a string in the desc column. The string from each call is separated by '  /  '. This is for free form messages that aren't necessarily present for every shot. The function works like printf.

If you want to add a column to record some information in every shot:
1) add the name to 'cols' in log_init
2) At the point in the script where you want to record a value, use log:set{your_column='you string'} to set it.

Both of the above just set the value to be saved in the next log line. The script writes out the complete line once per shot, with the log:write() call. It also tries to write out any partial lines one exit.
Don't forget what the H stands for.

*

Offline Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
Re: Add some information in log
« Reply #2 on: 15 / May / 2021, 11:51:59 »
We just had a similar question in the DE forum:
How to get the script´s title logged?
https://forum.chdk-treff.de/viewtopic.php?f=7&t=3369
We found that solution:  ::)
Code: [Select]
    --[[--
    @title Schnipsel V.0.5904 :)
    --]]--
    script_name=get_config_value(1054)
    title=script_name
    for lin in io.lines(script_name) do
        if lin:find("@title ") then title=string.sub(lin,7,42); break end
    end
    collectgarbage()
    print(title); print(script_name)
All lifetime is a loan from eternity.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal