Hide specific lines in code

Hi,

First of all, I use PhpStorm since a few weeks and it's the best IDE iIve used so far.

While using it, I found it would be useful if I could hide some specific lines in code.

The best example of it would be all the logs we put inside the code that makes it hard to read sometimes.

Example:

private function checkSystemRequirements()
    {
        $this->logger->log("Start system prerequisites check", PEAR_LOG_INFO);

        /* Make sure we run under a Linux OS */

        $this->logger->log("OS detection", PEAR_LOG_INFO);

        if (false === stristr(PHP_OS, "Linux")) {
            $this->lastError = "The Cmts library must be used under Linux. Actual OS \"" . PHP_OS . "\"";
            $this->logger->log($this->lastError, PEAR_LOG_ERROR);
            return false;
        }
    }


It would be nice if I could just hide all the logs lines beginning by

$this->logger->log(

and be able to show them all when wanted.

Is it something possible? Or maybe a good idea for a feature request?

4 comments
Comment actions Permalink

Hi Marc-Andre,

It is not currently possible to do that automatically. I have no idea how useful (or useless) it can be -- feel free to submit new Feature Request ticket on Issue Tracker here: http://youtrack.jetbrains.net/issues/WI

P.S.
I personally do not like "hide lines" idea -- using different and less visible color for the whole line -- that sounds much better in my eyes (as an ordinary PhpStorm user).

0
Comment actions Permalink

Ok, then I'll submit the feature request.

Is there a kind of best practice when is time to logs each steps of a script and with different levels of logs? If I want to log many levels it takes a lot of code and it's hard to follow just the code logic with all these logs in it.

0
Comment actions Permalink

Why do you need such extensive logging for every line of code? Maybe it will be better to just debug the issue in normal way? If something failing in your code it cannot be happening everywhere, otherwise it's not really your code but likely to be PHP or extension issue...

0
Comment actions Permalink

Well, it's more a kind of flow logs. I like to log at any level, when needed, by just changing log level in the config file. So when there's an issue in one of my application, I can quickly turned on more logs and debug faster. But this has the disadvantage that it overload code with logging code. That's the downside of it. But maybe i'm wrong, maybe there's a better method...

0

Please sign in to leave a comment.