Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement maktaba#log#GetFormattedEntries and support 1-arg handler #204

Merged
merged 2 commits into from
May 4, 2017

Conversation

dbarnett
Copy link
Contributor

@dbarnett dbarnett commented Apr 30, 2017

These changes help log handlers treat log entries as opaque data structures so maktaba can evolve the format as needed w/o having to coordinate versioning with callers. Entry format will be changed slightly in #103 after callers have a chance to migrate to this helper.

Note the "Not enough arguments" fallback could conceivably cause performance regressions until the callers are updated if there's a ton of logging, but I tried it out on a fairly heavy vim configuration with a lot of plugins and logging and I couldn't measure a reliable performance regression comparing time vim -c quit output with and without.

These changes help log handlers treat log entries as opaque data
structures so maktaba can evolve the format as needed w/o having to
coordinate versioning with callers. Entry format will be changed
slightly in #103 after callers have a chance to migrate to this helper.
Copy link
Member

@malcolmr malcolmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

endtry
return printf('%s %s [%s] %s',
\ l:level_name,
\ strftime('%Y-%m-%d@%H:%M:%S', l:timestamp),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using an ISO 8601 local date/time pattern? (e.g. '%Y-%m-%dT%H:%M:%S')?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@dbarnett dbarnett merged commit 02935bd into master May 4, 2017
@dbarnett dbarnett deleted the log_formatentries branch May 4, 2017 03:39
dbarnett added a commit that referenced this pull request May 8, 2017
Changes since 1.14.0:
  * Implement maktaba#buffer#GetVisualSelection helper (#132).
  * Implement maktaba#log#GetFormattedEntries and support 1-arg log
    handler (see #204).
  * Notify user for messages logged at WARN or above by default (#185).
  * Fix Syscall.CallAsync failing for complex commands (#205).
  * Preserve trailing slash in maktaba#path#Split and MakeRelative
    (#137 and #175).
  * Fix 'maxfuncdepth' error in maktaba#json#Parse corner case (#153).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants