Skip to content

Commit

Permalink
Fixed bug with reading default config values
Browse files Browse the repository at this point in the history
  • Loading branch information
Bob Olde Hampsink committed Apr 12, 2016
1 parent e38611b commit 8de3f5d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
12 changes: 6 additions & 6 deletions LogHelperPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getName()
*/
public function getVersion()
{
return '2.0.1';
return '2.0.2';
}

/**
Expand Down Expand Up @@ -60,28 +60,28 @@ public function getDeveloperUrl()
public function init()
{
// Disable web logging?
if (!craft()->config->get('useWebLog')) {
if (!craft()->config->get('useWebLog', 'logHelper')) {
craft()->log->removeRoute('WebLogRoute');
}

// Disable file logging?
if (!craft()->config->get('useFileLog')) {
if (!craft()->config->get('useFileLog', 'logHelper')) {
craft()->log->removeRoute('FileLogRoute');
}

// Disable profile logging?
if (!craft()->config->get('useProfileLog')) {
if (!craft()->config->get('useProfileLog', 'logHelper')) {
craft()->log->removeRoute('ProfileLogRoute');
}

// Use STDERR logging?
if (craft()->config->get('useStdErrLog')) {
if (craft()->config->get('useStdErrLog', 'logHelper')) {
require_once __DIR__.'/logging/LogHelper_StdErrLogRoute.php';
craft()->log->addRoute('Craft\LogHelper_StdErrLogRoute');
}

// Use SysLog logging?
if (craft()->config->get('useSysLog')) {
if (craft()->config->get('useSysLog', 'logHelper')) {
require_once __DIR__.'/logging/LogHelper_SysLogRoute.php';
craft()->log->addRoute('Craft\LogHelper_SysLogRoute');
}
Expand Down
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

## Introduction

When [logging events and errors](https://craftcms.com/support/logs-and-backups),
Craft CMS writes to the `craft/storage/runtime/logs/craft.log.` and
When [logging events and errors](https://craftcms.com/support/logs-and-backups),
Craft CMS writes to the `craft/storage/runtime/logs/craft.log.` and
`craft/storage/runtime/logs/phperrors.log` files.

This can cause problems on hosting environments that have an ephemeral
This can cause problems on hosting environments that have an ephemeral
filesystem (like Heroku, Amazon EC2 and some Docker configurations) as
the log files will not be persisted and logging data will get lost.
the log files will not be persisted and logging data will get lost.

This plugin adds the ability to Craft CMS to redirect logging output to
other sources than the default log files.

## Installation
## Installation

This plugin can be installed manually or [using Composer](https://getcomposer.org/doc/00-intro.md).

Expand All @@ -23,15 +23,15 @@ The preferred means of installation is through Composer:

composer require nerds-and-company/loghelper

This will add `nerds-and-company/loghelper` as a requirement to your
projects `composer.json` file and install the plugin into the
This will add `nerds-and-company/loghelper` as a requirement to your
projects `composer.json` file and install the plugin into the
`craft/plugins/loghelper` directory.

### Manual
### Manual

If installation through Composer is not an option, the package can also
be installed manually. Download [the latest release](https://github.com/nerds-and-company/loghelper/releases/latest)
or clone the contents of this repository into the `craft/plugins/loghelper`
or clone the contents of this repository into the `craft/plugins/loghelper`
directory.

__Important:__
Expand All @@ -41,7 +41,7 @@ The plugin's folder **must** be named "loghelper"
## Usage

This plugin offers different types of behaviour that can be configured
by editing the `craft/config/general.php` config file.
by editing the `craft/config/general.php` config file.

### Configuration

Expand Down Expand Up @@ -82,7 +82,7 @@ This allows for disabling Craft's default behaviour.
</table>

Determines whether logs should be written to STDERR (shell error output stream) or not.
Enabling this allows for viewing Craft logs on Heroku (or in tools that persist Heroku logs, like Papertrail).
Enabling this allows for viewing Craft logs on Heroku (or in tools that persist Heroku logs, like Papertrail).

'useStdErrLog' => false,

Expand Down Expand Up @@ -132,6 +132,10 @@ This plugin has been licensed under the MIT License (MIT). Please see [License F

## Changelog

### 2.0.2

- Fixed bug with reading default config values

### 2.0.1

- Adds more documentation
Expand Down

0 comments on commit 8de3f5d

Please sign in to comment.