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
b0b8056f
Commit
b0b8056f
authored
Apr 15, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #3108: Added `yii\debug\Module::enableDebugLogs` to disable logging debug logs by default
parent
740f5325
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
Module.php
extensions/debug/Module.php
+19
-3
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
No files found.
extensions/debug/Module.php
View file @
b0b8056f
...
...
@@ -54,6 +54,12 @@ class Module extends \yii\base\Module implements BootstrapInterface
* the oldest ones will be removed.
*/
public
$historySize
=
50
;
/**
* @var boolean whether to enable message logging for the requests about debug module actions.
* You normally do not want to keep these logs because they may distract you from the logs about your applications.
* You may want to enable the debug logs if you want to investigate how the debug module itself works.
*/
public
$enableDebugLogs
=
false
;
/**
* Returns Yii logo ready to use in `<img src="`
...
...
@@ -118,13 +124,23 @@ class Module extends \yii\base\Module implements BootstrapInterface
*/
public
function
beforeAction
(
$action
)
{
if
(
!
parent
::
beforeAction
(
$action
))
{
return
false
;
}
if
(
!
$this
->
enableDebugLogs
)
{
foreach
(
Yii
::
$app
->
getLog
()
->
targets
as
$target
)
{
$target
->
enabled
=
false
;
}
}
// do not display debug toolbar when in debug view mode
Yii
::
$app
->
getView
()
->
off
(
View
::
EVENT_END_BODY
,
[
$this
,
'renderToolbar'
]);
unset
(
Yii
::
$app
->
getLog
()
->
targets
[
'debug'
]);
$this
->
logTarget
=
null
;
if
(
$this
->
checkAccess
())
{
return
parent
::
beforeAction
(
$action
)
;
return
true
;
}
elseif
(
$action
->
id
===
'toolbar'
)
{
// Accessing toolbar remotely is normal. Do not throw exception.
return
false
;
}
else
{
throw
new
ForbiddenHttpException
(
'You are not allowed to access this page.'
);
...
...
framework/CHANGELOG.md
View file @
b0b8056f
...
...
@@ -5,6 +5,7 @@ Yii Framework 2 Change Log
--------------------------
-
Bug #3091: Fixed inconsistent treatment of
`Widget::run()`
when a widget is used as a container and as a self-contained object (qiangxue)
-
Enh #3108: Added
`yii\debug\Module::enableDebugLogs`
to disable logging debug logs by default (qiangxue)
-
no changes in this release.
...
...
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