Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
php-modules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
library
php-modules
Commits
6720d757
Commit
6720d757
authored
6 years ago
by
Hoop, Bert Jan de
Browse files
Options
Downloads
Patches
Plain Diff
L05DOCBST-38 always return this in LoggerTrait
parent
66d7b8ed
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/library/LoggerTrait.php
+21
-16
21 additions, 16 deletions
src/library/LoggerTrait.php
with
21 additions
and
16 deletions
src/library/LoggerTrait.php
+
21
−
16
View file @
6720d757
...
...
@@ -29,6 +29,7 @@ trait LoggerTrait {
/**
* set logger to send log messages to
* @param \Psr\Log\LoggerInterface $logger
* @return $this
*/
public
function
set_logger
(
\Psr\Log\LoggerInterface
$logger
)
{
...
...
@@ -40,73 +41,77 @@ trait LoggerTrait {
* debug message
* @param string $message
* @param array $context if not set the ndc is used
* @return
type
* @return
$this
*/
public
function
debug
(
string
$message
,
array
$context
=
null
)
{
if
(
!
isset
(
$this
->
logger
))
{
return
;
if
(
isset
(
$this
->
logger
))
{
$this
->
logger
->
debug
(
$message
,
isset
(
$context
)
?
$context
:
$this
->
ndc_context
)
;
}
$this
->
logger
->
debug
(
$message
,
isset
(
$context
)
?
$context
:
$this
->
ndc_context
)
;
return
$this
;
}
/**
* info message
* @param string $message
* @param array $context if not set the ndc is used
* @return
type
* @return
$this
*/
public
function
info
(
string
$message
,
array
$context
=
null
)
{
if
(
!
isset
(
$this
->
logger
))
{
return
;
if
(
isset
(
$this
->
logger
))
{
$this
->
logger
->
info
(
$message
,
isset
(
$context
)
?
$context
:
$this
->
ndc_context
)
;
}
$this
->
logger
->
info
(
$message
,
isset
(
$context
)
?
$context
:
$this
->
ndc_context
)
;
return
$this
;
}
/**
* warning message
* @param string $message
* @param array $context if not set the ndc is used
* @return
type
* @return
$this
*/
public
function
warning
(
string
$message
,
array
$context
=
null
)
{
if
(
!
isset
(
$this
->
logger
))
{
return
;
if
(
isset
(
$this
->
logger
))
{
$this
->
logger
->
warning
(
$message
,
isset
(
$context
)
?
$context
:
$this
->
ndc_context
)
;
}
$this
->
logger
->
warning
(
$message
,
isset
(
$context
)
?
$context
:
$this
->
ndc_context
)
;
return
$this
;
}
/**
* error message
* @param string $message
* @param array $context if not set the ndc is used
* @return
type
* @return
$this
*/
public
function
error
(
string
$message
,
array
$context
=
null
)
{
if
(
!
isset
(
$this
->
logger
))
{
return
;
if
(
isset
(
$this
->
logger
))
{
$this
->
logger
->
error
(
$message
,
isset
(
$context
)
?
$context
:
$this
->
ndc_context
)
;
}
$this
->
logger
->
error
(
$message
,
isset
(
$context
)
?
$context
:
$this
->
ndc_context
)
;
return
$this
;
}
/**
* add message to the ndc (nested diagnostic context)
* @param string $message
* @return $this
*/
public
function
ndc_push
(
string
$message
){
array_push
(
$this
->
ndc_context
,
$message
);
return
$this
;
}
/**
* remove last message from the ndc (nested diagnostic context)
* @return $this
*/
public
function
ndc_pop
(){
array_pop
(
$this
->
ndc_context
);
return
$this
;
}
}
\ No newline at end of file
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