Download the PHP package bref/monolog-bridge without Composer

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

This repository provides a Monolog log formatter optimized for AWS Lambda and CloudWatch.

Read all about logs in the Bref documentation.


Logs will be formatted to combine readability and structured data, making it easy to both read logs and filter them. Here's an example of a log record:

The JSON object contains the following fields (when applicable):

The JSON object is parsed by CloudWatch, allowing you to filter logs in CloudWatch Logs Insights. For example:

Installation

[!IMPORTANT]
This package is already installed if you use Bref's Laravel bridge or Symfony bridge. If you do, you don't need to install this package.

Usage

For Laravel applications, set the following environment variable in serverless.yml:

For Symfony applications, set the Bref Monolog formatter in your config/packages/prod/monolog.yaml:

For other applications, you can set the formatter in your Monolog configuration. For example:

Motivation

The goal of this is to improve the overall logs experience with CloudWatch.

The usual format is to log unstructured text. This sucks because:

Here's an example:

Screen-002902

A better approach is to switch to JSON-formatted logs:

But this isn't perfect:

Here's an example (Bref Cloud formats the JSON payload FYI, this isn't the case in CloudWatch):

Screen-002903

CloudWatch has some great features though:

The log message above will automatically get parsed as text (the first part) and a JSON object attached (the second part).

That means we can have a simple log message + a structured JSON object.

On top of that, with CloudWatch:

This is why I want to add this CloudWatchFormatter optimized for Bref users.

As you can see in the screenshots below, it is easy to navigate the logs textually. But it's also possible to have a lot more information nested in the log records via the JSON object.

In CloudWatch:

Screen-002905

In Bref Cloud:

Screen-002904

In CloudWatch Logs Insights, we can see that keys of the JSON objects are correctly detected:

Screen-002906

That allows us to create advanced queries, for example to search for "ERROR" logs with a specific exception class:

Screen-002907


All versions of monolog-bridge with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
monolog/monolog Version ^2.4|^3
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 bref/monolog-bridge contains the following files

Loading the files please wait ...