Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
Yeray Santana Hualde
syncEnrollments
Commits
fadadd0f
Commit
fadadd0f
authored
Feb 23, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow events to override the log class.
parent
157f619e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
4 deletions
+29
-4
log.php
laravel/log.php
+29
-4
No files found.
laravel/log.php
View file @
fadadd0f
...
...
@@ -10,7 +10,7 @@ class Log {
*/
public
static
function
exception
(
$e
)
{
static
::
write
(
'error'
,
static
::
format
(
$e
));
static
::
write
(
'error'
,
static
::
exception_line
(
$e
));
}
/**
...
...
@@ -19,7 +19,7 @@ class Log {
* @param Exception $e
* @return string
*/
protected
static
function
format
(
$e
)
protected
static
function
exception_line
(
$e
)
{
return
$e
->
getMessage
()
.
' in '
.
$e
->
getFile
()
.
' on line '
.
$e
->
getLine
();
}
...
...
@@ -41,9 +41,34 @@ class Log {
*/
public
static
function
write
(
$type
,
$message
)
{
$message
=
date
(
'Y-m-d H:i:s'
)
.
' '
.
Str
::
upper
(
$type
)
.
" -
{
$message
}
"
.
PHP_EOL
;
// If there is a listener for the log event, we'll delegate the logging
// to the event and not write to the log files. This allows for quick
// swapping of log implementations for debugging.
if
(
Event
::
listeners
(
'laravel.log'
))
{
Event
::
fire
(
'laravel.log'
,
array
(
$type
,
$message
));
}
File
::
append
(
path
(
'storage'
)
.
'logs/'
.
date
(
'Y-m-d'
)
.
'.log'
,
$message
);
// If there aren't listeners on the log event, we'll just write to the
// log files using the default conventions, writing one log file per
// day so they files don't get too crowded.
else
{
$message
=
static
::
format
(
$type
,
$message
);
File
::
append
(
path
(
'storage'
)
.
'logs/'
.
date
(
'Y-m-d'
)
.
'.log'
,
$message
);
}
}
/**
* Format a log message for logging.
*
* @param string $type
* @param
*/
protected
static
function
format
(
$type
,
$message
)
{
return
date
(
'Y-m-d H:i:s'
)
.
' '
.
Str
::
upper
(
$type
)
.
" -
{
$message
}
"
.
PHP_EOL
;
}
/**
...
...
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