vim-qf icon indicating copy to clipboard operation
vim-qf copied to clipboard

Introduce logging

Open ntnn opened this issue 8 years ago • 6 comments

Introduce logging

Soft-touched logging would be nice, e.g. qf#log, qf#debug and qf#error, which prefix the message with a vim-qf:level: and the debug level only showing when e.g. g:qf_debug is true or the like.

This'd help greatly with debugging in the future as well as help understand the code (e.g. on early returns etc.pp. a debug message would act like a comment explaining the early exit.

ntnn avatar Nov 01 '16 22:11 ntnn

For some of of my scripts I've used Decho. It is definitely not perfect but it is pretty easy to start using.

arecarn avatar Nov 14 '16 16:11 arecarn

@romainl what do you think? Do you want external dependencies? Another possibility would be to write our own logging library with structured logging - though that might be a bit oversized for a bit of scripting.

Sent with AquaMail for Android http://www.aqua-mail.com

On 14 November 2016 5:55:47 pm Ryan Carney [email protected] wrote:

For some of of my scripts I've used Decho. It is definitely not perfect but it is pretty easy to start using.

You are receiving this because you were assigned. Reply to this email directly or view it on GitHub: https://github.com/romainl/vim-qf/issues/22#issuecomment-260392649

ntnn avatar Nov 14 '16 16:11 ntnn

Silly me… that was #23.

romainl avatar Nov 14 '16 17:11 romainl

@ntnn I don't want external dependencies if I can avoid them. I'd like to play with :throw and friends before turning to a logging lib.

romainl avatar Nov 14 '16 17:11 romainl

A real vimscript logging library would be very nice, I could never seem find one.

Once potentially nice thing about Decho is that it is only a dependency for anyone who wants to use logging. In my case I just enabled it for debugging and disabled it before committing changes or fixes.

arecarn avatar Nov 14 '16 18:11 arecarn

No, having a difference in the code between dev and production is not a choice. I'd rather use a stub file which defines the functions as noops if the logging plugin is not loaded.

@romainl Mhm... I don't like exceptions, I'd rather sanitize input more. A properly written logging library would be nice, on the other hand simple logging would be just a case of using a s:log function and qf#error, qf#debug and qf#info, wrapping the s:log. Those three levels should be sufficient for most use.

ntnn avatar Nov 14 '16 19:11 ntnn