Sublime Forum

File Changes Log

#1

Request for “File Changes Log”. Not github powered! Simple logging option when enabled it would track any file changes like “CREATED”, “UPDATED”, “DELETED”, “RENAMED” with a DATE/TIME stampls. Logs can be stored in TEXT or JSON files.

Example Log:

YYYY-MM-DD | HH:MM:SS | CREATED | /home/web/project | index.php
YYYY-MM-DD | HH:MM:SS | UPDATED | /home/web/project | robots.txt
YYYY-MM-DD | HH:MM:SS | DELETED | /home/web/project | readme.txt
YYYY-MM-DD | HH:MM:SS | RENAMED | /home/web/project | readme.txt | readme-please.txt

or similar… then have some sort of built in viewer when some shortcut is pressed to see this changes.

Example Options:

“changes_log”: “true”, // to enable this log
“changes_log_options”: “all”, // updated,created,deleted
“changes_log_path”: “/some/custom/path/”

Your " Incremental Diff" idea is on the right track, this changes log can use similar aproach. But with more readable logs and maybe an option to actual view this logs.

Here is a very basic plugin I’m using now, coded this from example snippets on this forum.

import sublime, sublime_plugin, time as dt
log = '/home/web/edits.log'
class EditedFiles(sublime_plugin.EventListener):
    def on_post_save(self, v):
        file = v.file_name()
        file = os.path.split(file)[1]
        date = dt.strftime('%Y-%m-%d')
        time = dt.strftime('%H:%M:%S')
        text = date+' | '+time+' | '+file+"\n"
        open(log,'a+b').write((text).encode('utf-8'))

If you like to try it, simply save this as log.py in your
~/.config/sublime-text-3/Packages/User/

0 Likes