Download the PHP package stange/slog without Composer

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

Slog (Simple Log)

A simple PHP logging class

Preface

Slog is a simple PHP logging class which you can easily include in any of your projects.

Installing Slog

You can clone the latest version from GIT

Or just add Slog to your project via composer

Features

Examples

Basic Example


Using specific log types types and ANSI coloring capabilities

Slog contains different methods for you to inform different types of log messages. Also, by default, SLog will colorize your log output

Result:

alt tag

You can of course, disable output coloring


Log to a file

NOTE: ANSI colors will not be logged into the file


File only output example

In case you don't want to output to stdout, you can pass in 'echo'=>FALSE in the constructor or disable stdout output by using Slog::setEcho(FALSE).


Log Tagging

Logging is a great thing, however sometimes the amount of logged information can be cumbersome.

A cool feature of Slog is that you can tag your logs.

Tag your logs? What do you mean?

I mean that you can use certain "tags" in your log messages for logging messages of a certain kind but not others of a different kind.

Here is a brief example of two tagged log messages:

In the previous example, both messages will be logged and shown through stdout.

However, now, if we add a log tag to slog things will be a bit different.

Only messages which match the tag "tagOne" will be logged. Messages containing the tag "tagTwo" will be discarded, i.e: not logged.

You can log multiple tags if you need to, this would be a good idea when you want to increase your log verbosity

Adding or removing log tags on the run

You can add or remove a tag at any given point in time through the methods:

Loggable Trait and Loggable Interface

As an extra, I have included a simple logging trait which will enable you to use said trait in your own classes to make said class "Loggable", this trait contains three main methods:

NOTE: The trait will also prepend the CLASS name to the log, in this way, if you have multiple classes which make use of the loggable trait, you can identify which logs come from one class and which other logs come from another

Trait and Loggable interface implementation example

With the previous code we could easily do the following implementation


TODO (next release)


All versions of slog with dependencies

PHP Build Version
Package Version
Requires php Version ^5.3.3 || ^7.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 stange/slog contains the following files

Loading the files please wait ....