Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wp-logs
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
wp-logs
Commits
f6efcb62
Commit
f6efcb62
authored
3 years ago
by
Bartek Jaskulski
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix/no handler
parent
dabf6516
No related branches found
No related tags found
1 merge request
!18
Bugfix/no handler
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+5
-0
5 additions, 0 deletions
CHANGELOG.md
src/SimpleLoggerFactory.php
+9
-12
9 additions, 12 deletions
src/SimpleLoggerFactory.php
with
14 additions
and
12 deletions
CHANGELOG.md
+
5
−
0
View file @
f6efcb62
## [Unreleased]
### Fixed
-
Fixed no handler actually assigned when using combination of
NullHandler and actual one
## [1.7.1] - 2022-04-15
## [1.7.1] - 2022-04-15
### Fixed
### Fixed
-
Fixed the getLogger method from SimpleLoggerFactory
-
Fixed the getLogger method from SimpleLoggerFactory
...
...
This diff is collapsed.
Click to expand it.
src/SimpleLoggerFactory.php
+
9
−
12
View file @
f6efcb62
...
@@ -32,26 +32,23 @@ final class SimpleLoggerFactory implements LoggerFactory {
...
@@ -32,26 +32,23 @@ final class SimpleLoggerFactory implements LoggerFactory {
$logger
=
new
Logger
(
$this
->
channel
);
$logger
=
new
Logger
(
$this
->
channel
);
$wc_handler
=
$this
->
get_wc_handler
();
if
(
$this
->
options
->
use_wc_log
&&
\function_exists
(
'wc_get_logger'
)
)
{
if
(
$this
->
options
->
use_wc_log
)
{
$logger
->
pushHandler
(
$logger
->
pushHandler
(
$wc_handler
);
new
WooCommerceHandler
(
\wc_get_logger
(),
$this
->
options
->
levels
)
);
}
}
if
(
$this
->
options
->
use_wp_log
||
$wc_handler
instanceof
NullHandler
)
{
// Adding WooCommerce logger may have failed, if so add WP by default.
if
(
$this
->
options
->
use_wp_log
||
empty
(
$logger
->
getHandlers
()
)
)
{
$logger
->
pushHandler
(
$this
->
get_wp_handler
()
);
$logger
->
pushHandler
(
$this
->
get_wp_handler
()
);
}
}
return
$this
->
logger
=
$logger
;
return
$this
->
logger
=
$logger
;
}
}
private
function
get_wc_handler
():
HandlerInterface
{
if
(
function_exists
(
'wc_get_logger'
)
)
{
return
new
WooCommerceHandler
(
wc_get_logger
(),
$this
->
options
->
level
);
}
return
new
NullHandler
();
}
private
function
get_wp_handler
():
HandlerInterface
{
private
function
get_wp_handler
():
HandlerInterface
{
if
(
defined
(
'WP_DEBUG_LOG'
)
&&
WP_DEBUG_LOG
)
{
if
(
defined
(
'WP_DEBUG_LOG'
)
&&
WP_DEBUG_LOG
)
{
return
new
ErrorLogHandler
(
ErrorLogHandler
::
OPERATING_SYSTEM
,
$this
->
options
->
level
);
return
new
ErrorLogHandler
(
ErrorLogHandler
::
OPERATING_SYSTEM
,
$this
->
options
->
level
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment