barasher / go-exiftool

Golang wrapper for Exiftool : extract as much metadata as possible (EXIF, ...) from files (pictures, pdf, office documents, ...)
GNU General Public License v3.0
250 stars 44 forks source link

Add debug logging option #53

Closed jnathanh closed 2 years ago

jnathanh commented 2 years ago

It's a little hard to understand how the package is exercising exiftool, this debug option shows exactly what is happening on the wrapped shell and can help troubleshoot the CLI usage.

Sample Output

executing shell command:
     /opt/homebrew/bin/exiftool -stay_open True -@ -
sending to exiftool STDIN:
    -j
    /path/to/file.jpg
    -execute
barasher commented 2 years ago

Hi @jnathanh ! Great idea, thanks for the PR. I'm a bit busy today but I'll have a look at this tomorrow ;)

barasher commented 2 years ago

Sorry, miss-click

codecov-commenter commented 2 years ago

Codecov Report

Merging #53 (c901003) into master (0cce067) will increase coverage by 0.58%. The diff coverage is 88.88%.

@@            Coverage Diff             @@
##           master      #53      +/-   ##
==========================================
+ Coverage   79.62%   80.21%   +0.58%     
==========================================
  Files           2        2              
  Lines         265      283      +18     
==========================================
+ Hits          211      227      +16     
- Misses         37       38       +1     
- Partials       17       18       +1     
Impacted Files Coverage Δ
exiftool.go 71.42% <88.88%> (+1.76%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0cce067...c901003. Read the comment docs.

barasher commented 2 years ago

Don't you think that an "agrgegation key" to regroup log lines for an exiftool instance should be useful ? On a multi-threaded context, it won't be possible to link an exiftool instance and a log line.

What do you think ?

jnathanh commented 2 years ago

Don't you think that an "agrgegation key" to regroup log lines for an exiftool instance should be useful ? On a multi-threaded context, it won't be possible to link an exiftool instance and a log line.

  • Use exiftool pid as "aggregation key" ?
  • Add another parameter to the Debug function ?

What do you think ?

Well, first I'd say let's not worry about it until it actually becomes a pain point (maybe it's not even necessary).

That said, I can see that it would be necessary if you actually are trying to debug parallel executions. The exiftool PID seems like a sensible default if you want one.

barasher commented 2 years ago

I'm quite busy these last days. I won't be able to have a look until next week. Sorry :(

barasher commented 2 years ago

No response, closing this PR