Compare commits
4 Commits
fix_demarr
...
develop
Author | SHA1 | Date |
---|---|---|
Rudy Masson | e7253acfd8 | |
Rudy Masson | 08717e42d9 | |
Teddy Cornaut | 12ededccc9 | |
Rudy Masson | d006294376 |
|
@ -7,3 +7,5 @@
|
||||||
/public/bundles/
|
/public/bundles/
|
||||||
/var/
|
/var/
|
||||||
###< symfony/framework-bundle ###
|
###< symfony/framework-bundle ###
|
||||||
|
/supervisord.log
|
||||||
|
/supervisord.pid
|
|
@ -1,3 +1,3 @@
|
||||||
index:
|
# index:
|
||||||
path: /loginAppSaml
|
# path: /
|
||||||
controller: App\Controller\MainController::loginAppSaml
|
# controller: App\Controller\MainController::
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
# Using SetHandler avoids issues with using ProxyPassMatch in combination
|
# Using SetHandler avoids issues with using ProxyPassMatch in combination
|
||||||
# with mod_rewrite or mod_autoindex
|
# with mod_rewrite or mod_autoindex
|
||||||
<FilesMatch \.php$>
|
<FilesMatch \.php$>
|
||||||
SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://127.0.0.1:9000"
|
SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://127.0.0.1:9000"
|
||||||
# for Unix sockets, Apache 2.4.10 or higher
|
# for Unix sockets, Apache 2.4.10 or higher
|
||||||
# SetHandler proxy:unix:/path/to/fpm.sock|fcgi://dummy
|
# SetHandler proxy:unix:/path/to/fpm.sock|fcgi://dummy
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM ubuntu:20.04
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
ARG HTTP_PROXY=
|
ARG HTTP_PROXY=
|
||||||
ARG HTTPS_PROXY=
|
ARG HTTPS_PROXY=
|
||||||
|
@ -7,7 +7,7 @@ ARG https_proxy=
|
||||||
|
|
||||||
ENV WAITFORIT_VERSION="v2.4.1"
|
ENV WAITFORIT_VERSION="v2.4.1"
|
||||||
|
|
||||||
ARG PHP_VERSION="7.4"
|
ARG PHP_VERSION="8.1"
|
||||||
ENV PHP_VERSION $PHP_VERSION
|
ENV PHP_VERSION $PHP_VERSION
|
||||||
|
|
||||||
RUN export DEBIAN_FRONTEND=noninteractive && \
|
RUN export DEBIAN_FRONTEND=noninteractive && \
|
||||||
|
@ -17,7 +17,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
|
||||||
apt-get update -y && \
|
apt-get update -y && \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
git bash wget ca-certificates supervisor cron rsyslog mysql-client jq \
|
git bash wget ca-certificates supervisor cron rsyslog mysql-client jq \
|
||||||
mutt tree vim python python3 python3-setuptools python3-pip make \
|
mutt tree vim python3-setuptools python3-pip make \
|
||||||
php${PHP_VERSION}-cli php${PHP_VERSION}-ldap php${PHP_VERSION}-soap \
|
php${PHP_VERSION}-cli php${PHP_VERSION}-ldap php${PHP_VERSION}-soap \
|
||||||
php${PHP_VERSION}-intl php${PHP_VERSION}-curl php${PHP_VERSION}-gd \
|
php${PHP_VERSION}-intl php${PHP_VERSION}-curl php${PHP_VERSION}-gd \
|
||||||
php${PHP_VERSION}-xml php${PHP_VERSION}-bcmath \
|
php${PHP_VERSION}-xml php${PHP_VERSION}-bcmath \
|
||||||
|
@ -26,6 +26,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
|
||||||
php${PHP_VERSION}-ssh2 libxml2-utils \
|
php${PHP_VERSION}-ssh2 libxml2-utils \
|
||||||
locales \
|
locales \
|
||||||
apache2 \
|
apache2 \
|
||||||
|
libapache2-mod-fcgid \
|
||||||
ssh-client \
|
ssh-client \
|
||||||
acl moreutils \
|
acl moreutils \
|
||||||
sudo
|
sudo
|
||||||
|
@ -58,14 +59,14 @@ RUN chmod +x /loginapp/install-composer.sh &&\
|
||||||
# On active les mods d'apache nécessaires
|
# On active les mods d'apache nécessaires
|
||||||
RUN a2enmod rewrite
|
RUN a2enmod rewrite
|
||||||
RUN a2enmod proxy_fcgi setenvif
|
RUN a2enmod proxy_fcgi setenvif
|
||||||
RUN a2enconf php7.4-fpm
|
RUN a2enconf php8.1-fpm
|
||||||
RUN a2enmod proxy
|
RUN a2enmod proxy
|
||||||
RUN a2enmod expires
|
RUN a2enmod expires
|
||||||
RUN a2enmod headers
|
RUN a2enmod headers
|
||||||
|
|
||||||
# On injecte les bonnes configs apache et php-fpm
|
# On injecte les bonnes configs apache et php-fpm
|
||||||
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
|
COPY 000-default.conf /etc/apache2/sites-available/000-default.conf
|
||||||
COPY www.conf /etc/php/7.4/fpm/pool.d/www.conf
|
COPY www.conf /etc/php/8.1/fpm/pool.d/www.conf
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
@ -73,8 +74,8 @@ EXPOSE 80
|
||||||
WORKDIR /loginapp
|
WORKDIR /loginapp
|
||||||
|
|
||||||
# On démarre php-fpm une fois pour créer les sockets
|
# On démarre php-fpm une fois pour créer les sockets
|
||||||
RUN service php7.4-fpm start
|
RUN service php8.1-fpm start
|
||||||
RUN service php7.4-fpm stop
|
RUN service php8.1-fpm stop
|
||||||
|
|
||||||
|
|
||||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||||
|
@ -89,7 +90,7 @@ RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
|
||||||
|
|
||||||
COPY rsyslog.conf /etc/rsyslog.d/loginapp.conf
|
COPY rsyslog.conf /etc/rsyslog.d/loginapp.conf
|
||||||
COPY supervisor.ini /etc/supervisor/supervisor.ini
|
COPY supervisor.ini /etc/supervisor/supervisor.ini
|
||||||
COPY php.ini /etc/php/7.4/fpm/php.ini
|
COPY php.ini /etc/php/8.1/fpm/php.ini
|
||||||
|
|
||||||
VOLUME /container-lifecycle
|
VOLUME /container-lifecycle
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ stderr_logfile_maxbytes=0
|
||||||
|
|
||||||
[program:php-fpm]
|
[program:php-fpm]
|
||||||
environment=HOSTNAME="%(ENV_HOSTNAME)s"
|
environment=HOSTNAME="%(ENV_HOSTNAME)s"
|
||||||
command = /usr/sbin/php-fpm7.4 -F
|
command = /usr/sbin/php-fpm8.1 -F
|
||||||
autostart = true
|
autostart = true
|
||||||
autorestart = true
|
autorestart = true
|
||||||
directory = /loginapp
|
directory = /loginapp
|
||||||
|
|
|
@ -6,7 +6,7 @@ error_log=/dev/stderr
|
||||||
user = www-data
|
user = www-data
|
||||||
group = www-data
|
group = www-data
|
||||||
|
|
||||||
listen = /run/php/php7.4-fpm.sock
|
listen = /run/php/php8.1-fpm.sock
|
||||||
|
|
||||||
listen.owner = www-data
|
listen.owner = www-data
|
||||||
listen.group = www-data
|
listen.group = www-data
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
definir un port à exposer entre 3000 et 6000 exclus
|
||||||
|
définir un nom de container
|
|
@ -9,11 +9,5 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
class MainController extends AbstractController
|
class MainController extends AbstractController
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route("/loginAppSaml", name="login_app_saml")
|
|
||||||
*/
|
|
||||||
public function loginAppSaml(Request $request)
|
|
||||||
{
|
|
||||||
return new Response("saml");
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -4012,3 +4012,23 @@
|
||||||
2022-04-07 12:57:41,576 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
2022-04-07 12:57:41,576 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
||||||
2022-04-07 12:57:41,576 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
2022-04-07 12:57:41,576 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
||||||
2022-04-07 12:57:41,576 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
2022-04-07 12:57:41,576 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
||||||
|
2022-04-07 13:28:49,188 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
|
||||||
|
2022-04-07 13:28:49,190 INFO RPC interface 'supervisor' initialized
|
||||||
|
2022-04-07 13:28:49,190 CRIT Server 'unix_http_server' running without any HTTP authentication checking
|
||||||
|
2022-04-07 13:28:49,191 INFO supervisord started with pid 26
|
||||||
|
2022-04-07 13:28:50,194 INFO spawned: 'apache2' with pid 28
|
||||||
|
2022-04-07 13:28:50,197 INFO spawned: 'php-fpm' with pid 29
|
||||||
|
2022-04-07 13:28:50,199 INFO spawned: 'rsyslog' with pid 30
|
||||||
|
2022-04-07 13:28:51,229 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
||||||
|
2022-04-07 13:28:51,229 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
||||||
|
2022-04-07 13:28:51,229 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
||||||
|
2022-04-07 14:27:06,256 CRIT Supervisor is running as root. Privileges were not dropped because no user is specified in the config file. If you intend to run as root, you can set user=root in the config file to avoid this message.
|
||||||
|
2022-04-07 14:27:06,258 INFO RPC interface 'supervisor' initialized
|
||||||
|
2022-04-07 14:27:06,258 CRIT Server 'unix_http_server' running without any HTTP authentication checking
|
||||||
|
2022-04-07 14:27:06,258 INFO supervisord started with pid 26
|
||||||
|
2022-04-07 14:27:07,261 INFO spawned: 'apache2' with pid 27
|
||||||
|
2022-04-07 14:27:07,264 INFO spawned: 'php-fpm' with pid 28
|
||||||
|
2022-04-07 14:27:07,265 INFO spawned: 'rsyslog' with pid 29
|
||||||
|
2022-04-07 14:27:08,292 INFO success: apache2 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
||||||
|
2022-04-07 14:27:08,292 INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
||||||
|
2022-04-07 14:27:08,292 INFO success: rsyslog entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
12
|
26
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Psr\Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a simple Logger implementation that other Loggers can inherit from.
|
||||||
|
*
|
||||||
|
* It simply delegates all log-level-specific methods to the `log` method to
|
||||||
|
* reduce boilerplate code that a simple Logger that does the same thing with
|
||||||
|
* messages regardless of the error level has to implement.
|
||||||
|
*/
|
||||||
|
abstract class AbstractLogger implements LoggerInterface
|
||||||
|
{
|
||||||
|
use LoggerTrait;
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Psr\Log;
|
||||||
|
|
||||||
|
class InvalidArgumentException extends \InvalidArgumentException
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Psr\Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes log levels.
|
||||||
|
*/
|
||||||
|
class LogLevel
|
||||||
|
{
|
||||||
|
const EMERGENCY = 'emergency';
|
||||||
|
const ALERT = 'alert';
|
||||||
|
const CRITICAL = 'critical';
|
||||||
|
const ERROR = 'error';
|
||||||
|
const WARNING = 'warning';
|
||||||
|
const NOTICE = 'notice';
|
||||||
|
const INFO = 'info';
|
||||||
|
const DEBUG = 'debug';
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Psr\Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes a logger-aware instance.
|
||||||
|
*/
|
||||||
|
interface LoggerAwareInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Sets a logger instance on the object.
|
||||||
|
*
|
||||||
|
* @param LoggerInterface $logger
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function setLogger(LoggerInterface $logger);
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Psr\Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic Implementation of LoggerAwareInterface.
|
||||||
|
*/
|
||||||
|
trait LoggerAwareTrait
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The logger instance.
|
||||||
|
*
|
||||||
|
* @var LoggerInterface|null
|
||||||
|
*/
|
||||||
|
protected ?LoggerInterface $logger = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a logger.
|
||||||
|
*
|
||||||
|
* @param LoggerInterface $logger
|
||||||
|
*/
|
||||||
|
public function setLogger(LoggerInterface $logger)
|
||||||
|
{
|
||||||
|
$this->logger = $logger;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,125 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Psr\Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Describes a logger instance.
|
||||||
|
*
|
||||||
|
* The message MUST be a string or object implementing __toString().
|
||||||
|
*
|
||||||
|
* The message MAY contain placeholders in the form: {foo} where foo
|
||||||
|
* will be replaced by the context data in key "foo".
|
||||||
|
*
|
||||||
|
* The context array can contain arbitrary data. The only assumption that
|
||||||
|
* can be made by implementors is that if an Exception instance is given
|
||||||
|
* to produce a stack trace, it MUST be in a key named "exception".
|
||||||
|
*
|
||||||
|
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
|
||||||
|
* for the full interface specification.
|
||||||
|
*/
|
||||||
|
interface LoggerInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* System is unusable.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param mixed[] $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function emergency(string|\Stringable $message, array $context = []);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action must be taken immediately.
|
||||||
|
*
|
||||||
|
* Example: Entire website down, database unavailable, etc. This should
|
||||||
|
* trigger the SMS alerts and wake you up.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param mixed[] $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function alert(string|\Stringable $message, array $context = []);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Critical conditions.
|
||||||
|
*
|
||||||
|
* Example: Application component unavailable, unexpected exception.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param mixed[] $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function critical(string|\Stringable $message, array $context = []);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runtime errors that do not require immediate action but should typically
|
||||||
|
* be logged and monitored.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param mixed[] $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function error(string|\Stringable $message, array $context = []);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exceptional occurrences that are not errors.
|
||||||
|
*
|
||||||
|
* Example: Use of deprecated APIs, poor use of an API, undesirable things
|
||||||
|
* that are not necessarily wrong.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param mixed[] $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function warning(string|\Stringable $message, array $context = []);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normal but significant events.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param mixed[] $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function notice(string|\Stringable $message, array $context = []);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interesting events.
|
||||||
|
*
|
||||||
|
* Example: User logs in, SQL logs.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param mixed[] $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function info(string|\Stringable $message, array $context = []);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detailed debug information.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param mixed[] $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function debug(string|\Stringable $message, array $context = []);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs with an arbitrary level.
|
||||||
|
*
|
||||||
|
* @param mixed $level
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param mixed[] $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @throws \Psr\Log\InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function log($level, string|\Stringable $message, array $context = []);
|
||||||
|
}
|
|
@ -0,0 +1,142 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Psr\Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a simple Logger trait that classes unable to extend AbstractLogger
|
||||||
|
* (because they extend another class, etc) can include.
|
||||||
|
*
|
||||||
|
* It simply delegates all log-level-specific methods to the `log` method to
|
||||||
|
* reduce boilerplate code that a simple Logger that does the same thing with
|
||||||
|
* messages regardless of the error level has to implement.
|
||||||
|
*/
|
||||||
|
trait LoggerTrait
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* System is unusable.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param array $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function emergency(string|\Stringable $message, array $context = [])
|
||||||
|
{
|
||||||
|
$this->log(LogLevel::EMERGENCY, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action must be taken immediately.
|
||||||
|
*
|
||||||
|
* Example: Entire website down, database unavailable, etc. This should
|
||||||
|
* trigger the SMS alerts and wake you up.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param array $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function alert(string|\Stringable $message, array $context = [])
|
||||||
|
{
|
||||||
|
$this->log(LogLevel::ALERT, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Critical conditions.
|
||||||
|
*
|
||||||
|
* Example: Application component unavailable, unexpected exception.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param array $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function critical(string|\Stringable $message, array $context = [])
|
||||||
|
{
|
||||||
|
$this->log(LogLevel::CRITICAL, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Runtime errors that do not require immediate action but should typically
|
||||||
|
* be logged and monitored.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param array $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function error(string|\Stringable $message, array $context = [])
|
||||||
|
{
|
||||||
|
$this->log(LogLevel::ERROR, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exceptional occurrences that are not errors.
|
||||||
|
*
|
||||||
|
* Example: Use of deprecated APIs, poor use of an API, undesirable things
|
||||||
|
* that are not necessarily wrong.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param array $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function warning(string|\Stringable $message, array $context = [])
|
||||||
|
{
|
||||||
|
$this->log(LogLevel::WARNING, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normal but significant events.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param array $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function notice(string|\Stringable $message, array $context = [])
|
||||||
|
{
|
||||||
|
$this->log(LogLevel::NOTICE, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interesting events.
|
||||||
|
*
|
||||||
|
* Example: User logs in, SQL logs.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param array $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function info(string|\Stringable $message, array $context = [])
|
||||||
|
{
|
||||||
|
$this->log(LogLevel::INFO, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Detailed debug information.
|
||||||
|
*
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param array $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function debug(string|\Stringable $message, array $context = [])
|
||||||
|
{
|
||||||
|
$this->log(LogLevel::DEBUG, $message, $context);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs with an arbitrary level.
|
||||||
|
*
|
||||||
|
* @param mixed $level
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param array $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @throws \Psr\Log\InvalidArgumentException
|
||||||
|
*/
|
||||||
|
abstract public function log($level, string|\Stringable $message, array $context = []);
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Psr\Log;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This Logger can be used to avoid conditional log calls.
|
||||||
|
*
|
||||||
|
* Logging should always be optional, and if no logger is provided to your
|
||||||
|
* library creating a NullLogger instance to have something to throw logs at
|
||||||
|
* is a good way to avoid littering your code with `if ($this->logger) { }`
|
||||||
|
* blocks.
|
||||||
|
*/
|
||||||
|
class NullLogger extends AbstractLogger
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Logs with an arbitrary level.
|
||||||
|
*
|
||||||
|
* @param mixed $level
|
||||||
|
* @param string|\Stringable $message
|
||||||
|
* @param array $context
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @throws \Psr\Log\InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function log($level, string|\Stringable $message, array $context = [])
|
||||||
|
{
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue