Skip to content

Implementing a Psr-3 Logger upper \jLog::log #5866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

rldhont
Copy link
Collaborator

@rldhont rldhont commented Jun 27, 2025

The Psr-3 Logger has seven log levels :

  • emergency
  • alert
  • critical
  • error
  • warning
  • notice
  • info
  • debug

The log levels could be defined in the LizmapConfig.ini.php file or with setLogLevel of the Logger.

A main logger is available through the lizmap singleton : lizmap::getLogger() or can be instantiated with it's own level new Lizmap\Logger\Logger('info').

@rldhont rldhont added php Pull requests that update Php code backport release_3_10 labels Jun 27, 2025
@github-actions github-actions bot added this to the 3.11.0 milestone Jun 27, 2025
@rldhont rldhont requested review from Gustry, laurentj and mdouchin June 27, 2025 16:15
rldhont added 4 commits July 4, 2025 18:39
Require psr/log:2.* because psr/log 3.* is in conflict with symfony/console v5.4.47

```
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - symfony/console v5.4.47 conflicts with psr/log 3.0.2.
    - symfony/console v5.4.47 conflicts with psr/log 3.0.1.
    - symfony/console v5.4.47 conflicts with psr/log 3.0.0.
    - jelix/jelix dev-jelix-1.8.x requires symfony/console ^5.4.26 -> satisfiable by symfony/console[v5.4.47].
    - jelix/jelix is locked to version dev-jelix-1.8.x and an update of this package was not requested.
    - Root composer.json requires psr/log ^3.0 -> satisfiable by psr/log[3.0.0, 3.0.1, 3.0.2].

```

symfony/console could not be updated to version v7 because jelix-1.8.x requires symfony/console ^5.4.26
@rldhont rldhont marked this pull request as ready for review July 7, 2025 06:24
\lizmap::getLogger()->log($cat, $message);
} else {
\jLog::log($message, $cat);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a long term, maybe this function should launch a deprecated error ?

We may add a CustomLogger acting as PSR-3 logger but for the lizadmin file ?

// \lizmap::getAppContext()->logMessage($errormsg, 'lizmapadmin');
lizmap::getCustomLoger()->debug($errormsg);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're rights @nworr but do we still need a lizmap-admin log ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so , the aim of "lizmap-admin" is to display on admin backend some events (and keep more sensitive events to the errors.log, unreadable for non "sysadmin" users ) .

}
} else {
\jLog::logEx($exception, $cat);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release_3_10 php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants