Open johnrix opened 8 years ago
@johnrix good point, if you take a look at the code that is here, it should be pretty easy to add this. If you want to take a stab at this and submit a PR that would be great !
Would the prefix be added even if no text was selected?
@pdonias, yes i was thinking that i would remove the whole 'TEST' prefix config option if no text was selected, adn have a new option (logging prefix). That way if a user selects this option, they must define a logging prefix, and it is used for all console log functions. I would also like to have a part of this prefix be the line number, so that if a person just has a bunch of console log statements in different parts of the code, instead of just saying something like "console.log('PREFIX')", it could say something like "console.log('PREFIX LINE 40')" making it easier to identify.
Sounds great :)
@pdonias, were you planning on taking a shot at this ? i got started a little while back, but am going to be bogged down with some of my job responsibilities till the ned of the year, so wont be able to get to this anytime soon. Also, thanks so much for cleaning up some of the other issues for the package ?
I wasn't planning to do it right now but maybe later, I don't know. But I'll make sure to let you know if I'm working on it (by assigning myself on the issue, for example) so we don't do the same job twice.
perfect thanks.
Hi guys, apologies I didn't respond previously. I did clone the repo and start looking at it, but like yourself, got bogged down in work commitments. First time looking at Coffeescript or Atom extensions also, which slowed me up.
I do have another suggestion for improvement though, which is to have configurable log statements to support different languages besides Javascript, as well as custom log commands. I use PHP a good bit and have my own custom log command for the application I work on. It would be so handy to have this work for that also.
Perhaps a logging command template that applies per file extension? Maybe should be logged as a separate issue though?
@johnrix good idea, i think there is an issue already for this https://github.com/vishysank/console-log-atom/issues/5. I dont really use php, but do you have a sense of the log commands that you use ? Maybe if you can document them in an issue to enable php support, someone can pick it up to add that functionality
I've used various logging commands for PHP over the years, some being roll-your-own tools, other third party tools and also some PHP built-in commands, all depending upon the use case. Most recently, I wrapped one of my own in a global function named 'consolelog' with the same argument signature as the javascript console.log() function, so I can use your plugin and just remove the '.' before saving (PHP's object method/property access syntax uses arrows (->) instead of dots, so 'console.log' isn't feasible).
It would be handy to simply have a template field per file extension, where you can insert placeholders for the variable to log and the associated label eg.
myDebugClass->debug(%var, %label);
somedebugthing %var
etc.
Would be useful to have an option to set a logging prefix to use on all console log messages generated. This could then be used to quickly filter the log output in the console accordingly.