Download the PHP package sebk/small-logger without Composer

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

small-logger

Small logger is a simple php logger you can easily extends for your own need.

Basically, it implements possibility to log to : Standard output File (With log rotates) Http service such as logstash

It it easy to implement your own Formatter or Output writer.

SwitchLogicInterface allow you to implements your own logic to manage multiple log streams.

It also possible to add shortcut to logger for easier use by final developer.

Migrated

This lib has been migrated to framagit project.

A new composer package is available at https://packagist.org/packages/small/small-logger

Future commits will be done on framagit.

Install

Log to standard output

First define the switch loggic :

Then, you are abble to log :

Log to file

You can log to a single file :

Or redirect errors to another file :

In the second case, errors are redirected to the second file.

Then this call will write in '/var/log/my-log.log' :

And this call will write in '/var/log/my-error-log.log' :

Customizing logs

You can easy customize the behaviour of logs by writing your own classes implementing interfaces :

For example, we want to write to logstash. We will use the http type with the output factory. To get the best appropriate output for your project, use the output factory :

New we have the output, we can create our switcher :

In the getStream method, you can put your logic to manage more than one stream depends on $log itself or additional $data.

For example, you can set up a stream for error level and a stream for critical level.

If you want, the $data array may inject information to switch in complex architectures.

Now define your switch in logger and log :

Unit tests

To run unit tests, you are require to build unit-test container :

Then the container will build environement for testing and launch tests.

If you want to develop and add unit tests, turn off the BUILD environement var in docker-compose.yml by setting it to 0 :


All versions of small-logger with dependencies

PHP Build Version
Package Version
Requires php Version >=8.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 sebk/small-logger contains the following files

Loading the files please wait ....