Download the PHP package ody/logger without Composer

On this page you can find all versions of the php package ody/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

Logging

Logging is configured in config/logging.php and provides various channels for logging:

Custom Loggers in ODY Framework

Creating Custom Loggers

Basic Requirements

All custom loggers must:

  1. Extend Ody\Logger\AbstractLogger
  2. Implement a static create(array $config) method
  3. Override the write(string $level, string $message, array $context = []) method

Example: Creating a Custom Logger

Here's a simple example of a custom logger that logs to Redis:

The create() Method

The static create() method is responsible for instantiating your logger based on configuration:

This method receives the channel configuration from the logging.php config file and should:

  1. Create any dependencies the logger needs
  2. Configure those dependencies based on the config array
  3. Return a new instance of the logger

The write() Method

The write() method is where the actual logging happens:

This method is called by the parent AbstractLogger class when a log message needs to be written. It receives:

Using Custom Loggers

Method 1: Configuration-Based Discovery

The simplest way to use a custom logger is to specify the fully-qualified class name in your logging configuration:

When you specify a class parameter, that class will be used regardless of the driver name.

Method 2: Driver Name Registration

You can register your logger with a driver name, which allows you to reference it using just the driver name:

Then in your configuration:

Method 3: Automatic Discovery

If your logger follows the naming convention {Driver}Logger and is in one of the registered namespaces, it will be discovered automatically:

The framework will search for RedisLogger in the registered namespaces (\Ody\Logger\ and \App\Logging\ by default).

Creating Custom Formatters

If the standard formatters don't meet your needs, you can create your own by implementing the FormatterInterface:

Complete Example: Using Redis Logger

Configuration

Usage


With this system, you can create custom loggers that integrate seamlessly with the ODY Framework logging infrastructure.


All versions of logger with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
monolog/monolog Version ^3.9
psr/log Version ^3.0
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 ody/logger contains the following files

Loading the files please wait ....