phptek / silverstripe-sentry

Flexible Sentry compatible bug aggregation client for Silverstripe applications.
BSD 3-Clause "New" or "Revised" License
12 stars 22 forks source link

Add default values #40

Closed Firesphere closed 3 years ago

Firesphere commented 4 years ago

Partially fixes #6 and adds the last commit message as an extra bit of information.

Firesphere commented 4 years ago

The commands are prefixed with an @, to prevent it from throwing an error on it's own if the file doesn't exist or it doesn't have read access. Or, possibly, file_get_contents etc. does not have execution permissions.

phptek commented 4 years ago

You could probably abstract the GIT file logic into a private method on SentryLogger e.g. getGitfileContents() and then in one fell-swoop include the extra data:

Incomplete pseudo-code:

    public function defaultExtra() : array
    {
        $ref = $this->getGitfileContents($head[1]);
        $this->client->getOptions()->setRelease($ref);

        return [
            'Peak-Memory'   => $this->getPeakMemory(),
            'Commit Message' => $ref = $this->getGitfileContents('COMMIT_EDITMSG'),
        ];
    }
Firesphere commented 4 years ago

Good point :+1:

Firesphere commented 4 years ago

I've added some coverages etc. as well, so you could set up CodeClimate/CodeCov/Scrutinizer-CI (Free for OSS projects)

Firesphere commented 4 years ago

I did some code updates

Firesphere commented 4 years ago

Ping @phptek

phptek commented 4 years ago

Yeah, I've seen it. Been sick and busy recently.

Firesphere commented 4 years ago

Ow, apologies! Get well soon!

phptek commented 4 years ago

This work needs to be rebased against master (My fault, for being sick and then just plain tardy). Once you've attended to the comments above, please squash the x3 commitss. Thanks!

Firesphere commented 3 years ago

I totally did not have time. I've put it on my to do list for this week, to fix everything up properly!

Firesphere commented 3 years ago

Nope, time said no :/

phptek commented 3 years ago

Closing this in favour of using Composer\InstalledVersions::getRootPackage() called in SentryLogger::getAppInfo() in 4.0.0-alpha2 and above. This gives us the project name, branch and commit hash.