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
f6eb5e69
Commit
f6eb5e69
authored
Apr 09, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #2998: Added `framework\log\SyslogTarget` that is able to write log to syslog
parent
171cab2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
CHANGELOG.md
framework/CHANGELOG.md
+1
-0
SyslogTarget.php
framework/log/SyslogTarget.php
+6
-6
No files found.
framework/CHANGELOG.md
View file @
f6eb5e69
...
@@ -289,6 +289,7 @@ Yii Framework 2 Change Log
...
@@ -289,6 +289,7 @@ Yii Framework 2 Change Log
-
New #2149: Added
`yii\base\DynamicModel`
to support ad-hoc data validation (qiangxue)
-
New #2149: Added
`yii\base\DynamicModel`
to support ad-hoc data validation (qiangxue)
-
New #2360: Added
`AttributeBehavior`
and
`BlameableBehavior`
, and renamed
`AutoTimestamp`
to
`TimestampBehavior`
(lucianobaraglia, qiangxue)
-
New #2360: Added
`AttributeBehavior`
and
`BlameableBehavior`
, and renamed
`AutoTimestamp`
to
`TimestampBehavior`
(lucianobaraglia, qiangxue)
-
New #2932: Added
`yii\web\ViewAction`
that allow you to render views based on GET parameter (samdark)
-
New #2932: Added
`yii\web\ViewAction`
that allow you to render views based on GET parameter (samdark)
-
New #2998: Added
`framework\log\SyslogTarget`
that is able to write log to syslog (miramir, samdark)
-
New: Yii framework now comes with core messages in multiple languages
-
New: Yii framework now comes with core messages in multiple languages
-
New: Added
`yii\codeception\DbTestCase`
(qiangxue)
-
New: Added
`yii\codeception\DbTestCase`
(qiangxue)
-
New: Added
`yii\web\GroupUrlRule`
(qiangxue)
-
New: Added
`yii\web\GroupUrlRule`
(qiangxue)
...
...
framework/log/SyslogTarget.php
View file @
f6eb5e69
...
@@ -9,7 +9,7 @@ namespace yii\log;
...
@@ -9,7 +9,7 @@ namespace yii\log;
use
Yii
;
use
Yii
;
/**
/**
* SyslogTarget write log to syslog.
* SyslogTarget write
s
log to syslog.
*
*
* @author miramir <gmiramir@gmail.com>
* @author miramir <gmiramir@gmail.com>
* @since 2.0
* @since 2.0
...
@@ -17,9 +17,10 @@ use Yii;
...
@@ -17,9 +17,10 @@ use Yii;
class
SyslogTarget
extends
Target
class
SyslogTarget
extends
Target
{
{
/**
/**
* @var string
S
yslog identity
* @var string
s
yslog identity
*/
*/
public
$identity
;
public
$identity
;
/**
/**
* @var integer syslog facility.
* @var integer syslog facility.
*/
*/
...
@@ -35,15 +36,15 @@ class SyslogTarget extends Target
...
@@ -35,15 +36,15 @@ class SyslogTarget extends Target
Logger
::
LEVEL_INFO
=>
LOG_INFO
,
Logger
::
LEVEL_INFO
=>
LOG_INFO
,
Logger
::
LEVEL_WARNING
=>
LOG_WARNING
,
Logger
::
LEVEL_WARNING
=>
LOG_WARNING
,
Logger
::
LEVEL_ERROR
=>
LOG_ERR
,
Logger
::
LEVEL_ERROR
=>
LOG_ERR
,
];
];
/**
/**
* Writes log messages to
a syslog.
* Writes log messages to
syslog
*/
*/
public
function
export
()
public
function
export
()
{
{
openlog
(
$this
->
identity
,
LOG_ODELAY
|
LOG_PID
,
$this
->
facility
);
openlog
(
$this
->
identity
,
LOG_ODELAY
|
LOG_PID
,
$this
->
facility
);
foreach
(
$this
->
messages
as
$message
)
{
foreach
(
$this
->
messages
as
$message
)
{
syslog
(
$this
->
syslogLevels
[
$message
[
1
]],
$this
->
formatMessage
(
$message
));
syslog
(
$this
->
syslogLevels
[
$message
[
1
]],
$this
->
formatMessage
(
$message
));
}
}
closelog
();
closelog
();
...
@@ -64,5 +65,4 @@ class SyslogTarget extends Target
...
@@ -64,5 +65,4 @@ class SyslogTarget extends Target
return
"
{
$prefix
}
[
$level
][
$category
]
$text
"
;
return
"
{
$prefix
}
[
$level
][
$category
]
$text
"
;
}
}
}
}
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