Download the PHP package webiny/logger without Composer

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

Logger

Logger component is used to log data. You can log whatever you want to whatever destination, all you need to do is create a handler for your logger driver. This component was heavily inspired by https://github.com/Seldaek/monolog library (if you used that one before, this component will be very familiar to you). You may say it's identical, but we found some things we wanted to change/improve, like having a Record class with proper getters/setters, we changed some method namings, processing logic and other bits and pieces to better suite our framework. We do lack different handlers, formatters and processors out-of-the-box, but that will come with time.

Install the component

The best way to install the component is using Composer.

For additional versions of the package, visit the Packagist page.

Drivers

Built-in drivers are:

Null driver is used to turn off logging without changing your code. You simply change your configuration to use Null driver and all your logging calls will be sent into the void. Webiny driver contains most of the functionality you will ever need from a logger, so that driver is used by default.

Logger component uses PSR-3 Logger Interface and PSR-3 Log Levels. All log level constants are located in LoggerLevel class. With that being said, you can create your own logger driver, which will not even have handlers, formatters, processors, or anything like that. Just implement the logger interface and the rest is up to you. If you do like Monolog concept, then Webiny driver is the way to go.

Logger setup

Here is an example logger service setup, which uses a FileHandler, two processors and a FileFormatter. The structure of the config file is identical to all other Webiny components that register services.

NOTE: FileHandler in our example (LogHandler service) takes a File as first argument. We can only write to files using Storage component, so we need a service which provides us with a File instance.

To use your logger in PHP:

The logic behind logger setup and log message processing

  1. Create a logger instance
  2. Create a handler instance(s) (you can have multiple handlers in your logger)
  3. Add processors and formatters to your handler instance(s)
  4. Add handler(s) to your logger
  5. Use your logger

When you log a message, it goes through each handler, which in turn passes it to each processor. Formatter is the last thing to change a record. It simply formats the record into form that is appropriate for your handler. It may be string, array, etc. At the very end of processing - handler writes the formatted record to destination (be it file, database, email, socket, etc.)

Resources

To run unit tests, you need to use the following command:

$ cd path/to/Webiny/Component/Logger/
$ composer.phar install
$ phpunit

All versions of logger with dependencies

PHP Build Version
Package Version
Requires php Version ^7
webiny/config Version ~1.6
webiny/std-lib Version ~1.6
webiny/storage Version ~1.6
webiny/event-manager Version ~1.6
webiny/service-manager Version ~1.6
psr/log Version ~1.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 webiny/logger contains the following files

Loading the files please wait ....