Command: LogCommand (detailed action/items/undo csv-logging)

LogCommand - a wrapper for dopus commands to give you extended and persistent information about what has been done and when - in multiple daily logfiles.

Did you ever deleted something by accident or do you sometimes forget where you copied your last backup? o) Then this might be for you. The reason I did this is because the current undo-log does not give a hint on what files were affected by the last operation (if it were many) and it was last week I lost several hours of work by that fact. The current undo tells you: "You deleted 600 files there." But there's no way to look at these files, keep this information for later use or re-run an operation for items that failed (the re-run part needs manual work, this is no replacement for the builtin undo, but you have the option at least).

Featues and requirements:

  • works for nearly all commands related to files and folders
  • optional "friendly-log" to console
  • persistent logging to automatically created folders and files
  • logging of failed items
  • passing through of parameters and qualifiers
  • creates csv-data to easily inspect and reuse for heavy undo/redo operations e.g.
  • easy to use (I think)

Usage:

LogCommand has two important parameters, COMMAND and PARAMS. In case you'd like to log what files you delete and your standard delete command is:

Delete NoRecycle

Edit that command (if it's a hotkey, button, menu, file type context etc. does not matter) like that:

LogCommand COMMAND=Delete PARAMS=NoRecycle

Setup the log directory in the commands script config section or leave it as it is (it defaults to <dopus installation folder>\logs\yyyyy_mm_dd).

Delete something and watch the log directory for what happened.

Here is another usage demonstration on the copy command, to really make effective use of the log-wrapper it is necessary to edit ALL command like that.

I suggest doing so for all delete buttons/hotkeys and menu-items, if you'd like to log copy/move and clipboard operations as well it takes 10 minutes more to get these changed as well. I did and I hope to be on the safe side now.


To open the currently valid logfile directory use the GoLogs switch:

LogCommand GOLOGS

Parameters in detail:

  • Command, any command to wrap around and log
  • LogName, an optional name for the logfile (useful for a command like "Copy Move" to result in a logfile called yyyyy_mm_dd_Move_.log.csv
  • LogToFolder, enable disable logging to the logfolder
  • LogToConsole, enable disable logging to script console
  • LogFailedItems, enable disable logging of failed items (skipped/aborted/failed items when deleting/moving etc.)
  • ID, a custom identifier to separate log entries if desired
  • GoLogs, a switch to open the current folder with logfiles
  • Params, optional but always needs to be the last parameter, as everything after will be used as params for the actual command to run

Friendly, shorthand console output:

Script command config section:

Any hints to improve this are greatly appreciated! I hope it saves your *ss next time! o) In case anybody needs a logger for doing heavier scripting in DO, the script contains a logging "class" supporting different levels, append/overwrite, parallel console output, works outside of DO as well and the best thing is, it supports indents and it can serialize output to dopus console to prevent "log-trashing" if you're using dopus events and all these fire at the same time. Should give this a dedicated thread maybe. All for now, cya! o)

Installation:

To install the command, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.

After that edit as much buttons/menu entries and hotkeys as possible and wrap any delete/move/copy operation with LogCommand.

Download:

Note that the File Log (distinct from the Undo Log) in Opus can log additional information out-of-the-box, based on settings in Preferences / File Operations / Logging.

For deletions, the build-in File Log will still only give summary information when using the Recycle Bin, but it can be configured to log everything, down to individual files in recursive folder deletions, when not using the Recycle Bin.

Yes, that builtin logging functionality is surely nice to have, but accessing information from there is cumbersome. The format it saves takes real work to create a list of affected files from and it does not store information persistent nor long enough (I've tried getting my affected file-names back, which I trashed by hitting the wrong button last week, but they're already gone past that 9999 entry limit).

I would of course prefer builtin functionality, but it's not up my needs at the moment. I'm deeply grateful for what the scripting pulls out here, awesome (despite that qualifier-pass-through-thing, you maybe look at sooner or later). You say sooner, oh nice! Just kidding. o) Having a real history now, to browse all operations from the past, manipulate, backup and search through is a great leap forward.

Updated to v0.4.2

  • added detection for "clipboard paste" commands, to use items from clipboard

The log format by the way is:

<date>;<time>;<command>;<id>;<qualifiers>;<itemtype>;<result>;<item.name>;<item.path>;<item.realpath>;<source-lister path>;<dest-lister path>