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
f0dcceb3
Commit
f0dcceb3
authored
Mar 27, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ensure Dispatchers logger gets set when requested.
fixes #2894
parent
f4395206
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
11 deletions
+40
-11
Dispatcher.php
framework/log/Dispatcher.php
+38
-9
User.php
framework/web/User.php
+2
-2
No files found.
framework/log/Dispatcher.php
View file @
f0dcceb3
...
@@ -50,6 +50,12 @@ use yii\base\Component;
...
@@ -50,6 +50,12 @@ use yii\base\Component;
* Yii::$app->log->targets['file']->enabled = false;
* Yii::$app->log->targets['file']->enabled = false;
* ~~~
* ~~~
*
*
* @property integer $flushInterval How many messages should be logged before they are sent to targets. This
* method returns the value of [[Logger::flushInterval]].
* @property Logger $logger The logger. If not set, [[\Yii::getLogger()]] will be used.
* @property integer $traceLevel How many application call stacks should be logged together with each message.
* This method returns the value of [[Logger::traceLevel]]. Defaults to 0.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
*/
*/
...
@@ -61,9 +67,10 @@ class Dispatcher extends Component
...
@@ -61,9 +67,10 @@ class Dispatcher extends Component
*/
*/
public
$targets
=
[];
public
$targets
=
[];
/**
/**
* @var Logger the logger.
If not set, [[\Yii::getLogger()]] will be used.
* @var Logger the logger.
*/
*/
public
$logger
;
private
$_logger
;
/**
/**
* Initializes the logger by registering [[flush()]] as a shutdown function.
* Initializes the logger by registering [[flush()]] as a shutdown function.
...
@@ -78,10 +85,32 @@ class Dispatcher extends Component
...
@@ -78,10 +85,32 @@ class Dispatcher extends Component
}
}
}
}
if
(
$this
->
logger
===
null
)
{
// connect logger and dispatcher
$this
->
logger
=
Yii
::
getLogger
();
$this
->
getLogger
();
}
/**
* Gets the connected logger.
* If not set, [[\Yii::getLogger()]] will be used.
* @property Logger the logger. If not set, [[\Yii::getLogger()]] will be used.
* @return Logger the logger.
*/
public
function
getLogger
()
{
if
(
$this
->
_logger
===
null
)
{
$this
->
_logger
=
Yii
::
getLogger
();
$this
->
_logger
->
dispatcher
=
$this
;
}
}
$this
->
logger
->
dispatcher
=
$this
;
return
$this
->
_logger
;
}
/**
* Sets the connected logger.
* @param Logger $value the logger.
*/
public
function
setLogger
(
$value
)
{
$this
->
_logger
=
$value
;
}
}
/**
/**
...
@@ -90,7 +119,7 @@ class Dispatcher extends Component
...
@@ -90,7 +119,7 @@ class Dispatcher extends Component
*/
*/
public
function
getTraceLevel
()
public
function
getTraceLevel
()
{
{
return
$this
->
logger
->
traceLevel
;
return
$this
->
getLogger
()
->
traceLevel
;
}
}
/**
/**
...
@@ -101,7 +130,7 @@ class Dispatcher extends Component
...
@@ -101,7 +130,7 @@ class Dispatcher extends Component
*/
*/
public
function
setTraceLevel
(
$value
)
public
function
setTraceLevel
(
$value
)
{
{
$this
->
logger
->
traceLevel
=
$value
;
$this
->
getLogger
()
->
traceLevel
=
$value
;
}
}
/**
/**
...
@@ -110,7 +139,7 @@ class Dispatcher extends Component
...
@@ -110,7 +139,7 @@ class Dispatcher extends Component
*/
*/
public
function
getFlushInterval
()
public
function
getFlushInterval
()
{
{
return
$this
->
logger
->
flushInterval
;
return
$this
->
getLogger
()
->
flushInterval
;
}
}
/**
/**
...
@@ -123,7 +152,7 @@ class Dispatcher extends Component
...
@@ -123,7 +152,7 @@ class Dispatcher extends Component
*/
*/
public
function
setFlushInterval
(
$value
)
public
function
setFlushInterval
(
$value
)
{
{
$this
->
logger
->
flushInterval
=
$value
;
$this
->
getLogger
()
->
flushInterval
=
$value
;
}
}
/**
/**
...
...
framework/web/User.php
View file @
f0dcceb3
...
@@ -46,8 +46,8 @@ use yii\base\InvalidConfigException;
...
@@ -46,8 +46,8 @@ use yii\base\InvalidConfigException;
*
*
* @property string|integer $id The unique identifier for the user. If null, it means the user is a guest.
* @property string|integer $id The unique identifier for the user. If null, it means the user is a guest.
* This property is read-only.
* This property is read-only.
* @property IdentityInterface
$identity The identity object associated with the currently logged-in user.
* @property IdentityInterface
|null $identity The identity object associated with the currently logged-in
*
Null
is returned if the user is not logged in (not authenticated).
*
user. `null`
is returned if the user is not logged in (not authenticated).
* @property boolean $isGuest Whether the current user is a guest. This property is read-only.
* @property boolean $isGuest Whether the current user is a guest. This property is read-only.
* @property string $returnUrl The URL that the user should be redirected to after login. Note that the type
* @property string $returnUrl The URL that the user should be redirected to after login. Note that the type
* of this property differs in getter and setter. See [[getReturnUrl()]] and [[setReturnUrl()]] for details.
* of this property differs in getter and setter. See [[getReturnUrl()]] and [[setReturnUrl()]] for details.
...
...
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