Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
38c056c7
Commit
38c056c7
authored
Jun 26, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved handling from Target to Dispatcher, fixed edge cases
parent
a92dd65e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
Dispatcher.php
framework/log/Dispatcher.php
+17
-1
Target.php
framework/log/Target.php
+1
-7
No files found.
framework/log/Dispatcher.php
View file @
38c056c7
...
...
@@ -175,10 +175,26 @@ class Dispatcher extends Component
*/
public
function
dispatch
(
$messages
,
$final
)
{
$targetErrors
=
[];
foreach
(
$this
->
targets
as
$target
)
{
if
(
$target
->
enabled
)
{
$target
->
collect
(
$messages
,
$final
);
try
{
$target
->
collect
(
$messages
,
$final
);
}
catch
(
\Exception
$e
)
{
$target
->
enabled
=
false
;
$targetErrors
[]
=
[
'Unable to send log via '
.
get_class
(
$target
)
.
': '
.
$e
->
getMessage
(),
Logger
::
LEVEL_WARNING
,
__METHOD__
,
microtime
(
true
),
[],
];
}
}
}
if
(
!
empty
(
$targetErrors
))
{
$this
->
dispatch
(
$targetErrors
,
true
);
}
}
}
framework/log/Target.php
View file @
38c056c7
...
...
@@ -105,13 +105,7 @@ abstract class Target extends Component
if
((
$context
=
$this
->
getContextMessage
())
!==
''
)
{
$this
->
messages
[]
=
[
$context
,
Logger
::
LEVEL_INFO
,
'application'
,
YII_BEGIN_TIME
];
}
try
{
$this
->
export
();
}
catch
(
\Exception
$e
)
{
$this
->
enabled
=
false
;
\Yii
::
warning
(
'Unable to send log via '
.
get_class
(
$this
)
.
': '
.
$e
->
getMessage
(),
__METHOD__
);
\Yii
::
getLogger
()
->
flush
(
true
);
}
$this
->
export
();
$this
->
messages
=
[];
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment