Download the PHP package dotkernel/dot-log without Composer

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

dot-log

OSS Lifecycle PHP from Packagist (specify version)

GitHub issues GitHub forks GitHub stars GitHub license

Build Static codecov

SymfonyInsight

Adding The Config Provider

Configuring the writer(s)

Loggers must have at least one writer.

A writer is an object that inherits from Dot\Log\Writer\AbstractWriter. A writer's responsibility is to record log data to a storage backend.

Writing to a file (stream)

It is possible separate logs into multiple files using writers and filters. For example warnings.log, errors.log, all_messages.log.

The following is the simplest example to write all log messages to /log/dk.log

The writer priority key is not affecting the errors that are written, it is a way to organize writers.

The writer priority key is optional.

To write into a file the key stream must be present in the writer options array. This is required only if writing into streams/files.

Grouping log files by date

By default, logs will be written to the same file: log/dk.log. Optionally, you can use date format specifiers wrapped between curly braces in your FileWriter's stream option, automatically grouping your logs by day, week, month, year etc. Examples:

The full list of format specifiers is available here.

Filtering log messages

As per PSR-3 document.

The log levels are: emergency (0), alert (1), critical (2), error (3), warn (4), notice (5), info (6), debug (7) (in order of priority/importance)

Although the plain Logger in Dot Log is not fully compatible with PSR-3, it provides a way to log all of these message types.

The following example has three file writers using filters:

As in the writer configuration, the developer can optionally use keys for associating the filters with a name.

IMPORTANT NOTE: the operator for more important messages is <=, this is because the number representation is smaller for a more important message type.

The filter added on the first writer is equal to not setting a filter, but it was been added to illustrate how to explicitly allow all messages.

It was added opposite to the others just to demonstrate the other operator is also an option.

Formatting Messages

When using dot-log, the logged value is not limited to a string. Arrays can be logged as well.

For a better readability, these arrays can be serialized.

Dot Log provides String formatting and JSON formatting.

The formatter accepts following parameters:

name - the formatter class (it must implement Dot\Log\Formatter\FormatterInterface) options - options to pass to the formatter constructor if required

The following formats the message as JSON data:

Example with formatter

Usage

Basic usage of the logger is illustrated below.

The messages are written to see which logs are written and which are not written.

...

Extracted from this article


All versions of dot-log with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0 || ~8.2.0 || ~8.3.0
laminas/laminas-servicemanager Version ^3.22
laminas/laminas-validator Version ^2.64
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 dotkernel/dot-log contains the following files

Loading the files please wait ....