Download the PHP package pauloamgomes/logger without Composer

On this page you can find all versions of the php package pauloamgomes/logger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package logger

Cockpit CMS Logger Addon

This addon extends Cockpit CMS (Next) core by providing logging functionality based on the awesome Monolog Library.

Installation

Installation can be performed with ot without php composer.

Without php composer

  1. Download zip and extract to 'your-cockpit-docroot/addons/Logger' (e.g. cockpitcms/addons/Logger)
  2. Install Monolog dependency using composer

  3. Access module settings https://your-cockpit-site/settings/logger and confirm that page loads.

Using php composer

  1. Install addon using composer

Configuration

The Logger operations are available to the super admin user, and they can be used by other users if they belong to a group with proper permissions. The following permissions are defined:

Above ACLs can be added to the global configuration file as below:

Main Settings

The settings page provide all the main configurations:

Cockpit Logger settings page

  1. Enable - Check that option to enable the logging

  2. Context attributes - included in the logging entry as an extra array

    • Username - Includes the username of the active user
    • Hostname - Includes the hostname of the request
    • Request URI - Includes the request URI
    • Referrer - Includes the Referrer URI
    • HTTP Method - Includes the HTTP method of the request
  3. Log Level - Set the log level

    Cockpit Logger uses the same log levels defined in Monolog:

    • DEBUG
    • INFO
    • NOTICE
    • WARNING
    • ERROR
    • CRITICAL
    • ALERT
    • EMERGENCY

    When its set to DEBUG, additional details about the request will be included in the log entry:

    • Duration time
    • Memory used
    • Number of loaded php files

Monolog settings

The Monolog sections are resumed to the Formatter and Handler.

Formatters

A formatter defines the structure of the log entries, Cockpit Logger supports three Monolog formatters

Formatter Purpose
LineFormatter Formats a log record into a one-line string.
JsonFormatter Formats a log record into json
HtmlFormatter Used to format log records into a human readable html table, mainly suitable for emails.

Its also possible to define the format of the date in the log entries, the value must be a valid PHP date format like Y-m-d H:i:s

Handlers

A handler defines how the logs will be saved. Cockpit Logger provides two Handlers:

Handler Purpose
StreamHandler Saves log entries in the filesystem using the configured location and filename
SyslogHandler Writes the log entries using the operating system syslog functionality. Requires an ident and syslog facility.
SyslogUdpHandler Pushes the log entries to a remove rsyslog server.

The StreamHandler requires two additional settings:

The SyslogHandler requires also to additional settings:

Settings via config.yaml

Besides the configuration page the settings can also be defined in the cockpit config/config.yaml file, e.g.:

When using the config.yaml, the settings will take precedence over the configuration page.

Event Settings

Most relevant Cockpit events (e.g. User login, Collection removal) are logged automatically:

If required to disable, they can be disabled in the config.yaml, e.g:

Examples

Logging on other addons using the Logger functions:

The Cockpit Logger can be used on any other code by just invoking the module, e.g.:

Viewing the most recent logs in Cockpit

Logs can be accessed on the server and processed using any tool, additionaly its also possible to access from the UI to the most recent log entries - https://your-cockpit-site/recent-logs.

Recent log messages

The UI supports automatic fetch and dynamic filters:

Recent log messages using filters

Security considerations

When using the StreamLogger and the log location is set to the #storage:logs ensure that file is not public accessible.

Copyright and license

Copyright 2018 pauloamgomes under the MIT license.


All versions of logger with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
monolog/monolog Version ^1.23
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pauloamgomes/logger contains the following files

Loading the files please wait ....