This package is abandoned and no longer maintained. No replacement package was suggested.

Logging module for the Daedalus web framework

v2.1.1 2018-03-31 03:10 UTC

This package is not auto-updated.

Last update: 2021-10-04 19:29:06 UTC


README

Build Status Scrutinizer Code Quality Packagist version Code Coverage

Logging module for the Daedalus web application framework.

Installation

This is a logging library, and should probably not be installed directly. To install the Daedalus framework into a new project:

composer create-project daedalus-web/daedalus your-project-name 0.*

If you know what you're doing and want to use this logging library directly, you can add it to your composer.json file:

{
  "require": {
    "daedalus-web/logger": "^2.0"
  }
}

Usage

## Set the namespace up to be used directly
use Daedalus\Logger\Logger as Logger;

## Log an error
Logger::error('An error has been encountered and stuff broke.', [ 'file' => 'YourClass.php', 'line', 'Line 671', 'parameter' => 'value' ]);

Logger has 6 levels of logging:

  • Alert - used for critical errors and issues that require immediate admin notification [All Levels]
  • Critical - used for critical errors, such as when systems are unavailable [All Levels]
  • Error - used for application-level errors that cannot be recovered from [Level 2]
  • Warning - used for application-level errors that the application can recover from [Level 3]
  • Info - used for informational logging, such as when an API key is used or a section is accessed [Level 4]
  • Debug - used for when verbose, debugging logging is required. Used often for development configurations [Level 5]

Settings

Settings can optionally be passed to the logger class when creating it. By default, Logger will save logs to your project root directory, in /storage/logs. By default, Logger uses a verbosity level of 3 (no debug, no info). Setting the Verbosity Level automatically includes logging levels with a lower verbosity (e.g: Setting Verbosity Level to 4 automatically includes Levels 1-3 as well as 4, but disables Level 5 [])

Logger will search your project root directory for a .env file. If that file is found, Logger will use the following settings

$settings = [
  'type' => getenv(DAEDALUS_LOGGER_TYPE),
  'verbosity_level' => getenv(DAEDALUS_LOGGER_VERBOSITY),
  'file_log_path' => getenv(DAEDALUS_LOGGER_PAT)H
];

If the DAEDALUS_LOGGER_PATH does not exist, logger will create it.

About

Requirements

Daedalus Logger is fully tested to work with:

  • PHP 7.0
  • PHP 7.1

Strictly speaking, this module can be modified to support PHP 5.5+, however we use strict variable typing that is not available in PHP versions before 7.0. Because PHP 5.6 is no longer receiving active support (and will only be receiving security updates for another year), we strongly recommend starting any new project with PHP 7 or later.

Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub

Author

Josh Grancell - josh@joshgrancell.com - https://github.com/jgrancell

License

Daedalus Logger is licensed under the MIT License - see the LICENSE file for details