Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
eca260a3
Commit
eca260a3
authored
9 years ago
by
Jaime Perez Crespo
Browse files
Options
Downloads
Patches
Plain Diff
Reformat SimpleSAML_Logger_LoggingHandlerFile.
parent
bfe70e3f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SimpleSAML/Logger/LoggingHandlerFile.php
+11
-12
11 additions, 12 deletions
lib/SimpleSAML/Logger/LoggingHandlerFile.php
with
11 additions
and
12 deletions
lib/SimpleSAML/Logger/LoggingHandlerFile.php
+
11
−
12
View file @
eca260a3
<?php
/**
* A class for logging
*
* @author Lasse Birnbaum Jensen, SDU.
* @author Andreas Åkre Solberg, UNINETT AS. <andreas.solberg@uninett.no>
* @package SimpleSAMLphp
* @version $ID$
*/
class
SimpleSAML_Logger_LoggingHandlerFile
implements
SimpleSAML_Logger_LoggingHandler
{
...
...
@@ -17,11 +16,11 @@ class SimpleSAML_Logger_LoggingHandlerFile implements SimpleSAML_Logger_LoggingH
*
* @var null|string
*/
protected
$logFile
=
NULL
;
protected
$logFile
=
null
;
/**
* This array contains the mappings from syslog loglevel to names. Copied
*
more or less directly from
SimpleSAML_Logger_LoggingHandlerErrorLog.
* This array contains the mappings from syslog log
level
s
to names. Copied
more or less directly from
* SimpleSAML_Logger_LoggingHandlerErrorLog.
*/
private
static
$levelNames
=
array
(
SimpleSAML\Logger
::
EMERG
=>
'EMERGENCY'
,
...
...
@@ -33,7 +32,7 @@ class SimpleSAML_Logger_LoggingHandlerFile implements SimpleSAML_Logger_LoggingH
SimpleSAML\Logger
::
INFO
=>
'INFO'
,
SimpleSAML\Logger
::
DEBUG
=>
'DEBUG'
,
);
private
$processname
=
NULL
;
private
$processname
=
null
;
private
$format
;
...
...
@@ -46,19 +45,19 @@ class SimpleSAML_Logger_LoggingHandlerFile implements SimpleSAML_Logger_LoggingH
assert
(
$config
instanceof
SimpleSAML_Configuration
);
// get the metadata handler option from the configuration
$this
->
logFile
=
$config
->
getPathValue
(
'loggingdir'
,
'log/'
)
.
$this
->
logFile
=
$config
->
getPathValue
(
'loggingdir'
,
'log/'
)
.
$config
->
getString
(
'logging.logfile'
,
'simplesamlphp.log'
);
$this
->
processname
=
$config
->
getString
(
'logging.processname'
,
'SimpleSAMLphp'
);
if
(
@
file_exists
(
$this
->
logFile
))
{
if
(
!@
is_writeable
(
$this
->
logFile
))
{
throw
new
Exception
(
"Could not write to logfile: "
.
$this
->
logFile
);
throw
new
Exception
(
"Could not write to logfile: "
.
$this
->
logFile
);
}
}
else
{
if
(
!@
touch
(
$this
->
logFile
))
{
throw
new
Exception
(
"Could not create logfile: "
.
$this
->
logFile
.
"
L
oggingdir is not writ
e
able for the webserver user."
"Could not create logfile: "
.
$this
->
logFile
.
"
The l
ogging
dir
ectory
is not writable for the web
server user."
);
}
}
...
...
@@ -81,12 +80,12 @@ class SimpleSAML_Logger_LoggingHandlerFile implements SimpleSAML_Logger_LoggingH
/**
* Log a message to the log file.
*
* @param int $level The log level.
* @param int
$level The log level.
* @param string $string The formatted message to log.
*/
public
function
log
(
$level
,
$string
)
{
if
(
$this
->
logFile
!=
NULL
)
{
if
(
$this
->
logFile
!=
null
)
{
// set human-readable log level. Copied from SimpleSAML_Logger_LoggingHandlerErrorLog.
$levelName
=
sprintf
(
'UNKNOWN%d'
,
$level
);
if
(
array_key_exists
(
$level
,
self
::
$levelNames
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment