You are a developer and looking for Shopware projects?
Apply Now!
createLogger example
if
(
!
$container
->
hasParameter
(
$logLevel
=
$this
->
getParameterNameLogLevel
(
$servicePrefix
)
)
)
{
$container
->
setParameter
(
$logLevel
,
$container
->
getParameter
(
'shopware.logger.level'
)
)
;
}
if
(
!
$container
->
hasParameter
(
$logMaxFiles
=
$this
->
getParameterNameLoggerMaxFiles
(
$servicePrefix
)
)
)
{
$container
->
setParameter
(
$logMaxFiles
, 14
)
;
}
$container
->
setDefinition
(
$this
->
getServiceIdLoggerHandler
(
$servicePrefix
)
,
$this
->
createLoggerHandler
(
$servicePrefix
)
)
;
$container
->
setDefinition
(
$this
->
getServiceIdLoggerFormatter
(
$servicePrefix
)
,
$this
->
createLoggerFormatter
(
)
)
;
$container
->
setDefinition
(
$this
->
getServiceIdLogger
(
$servicePrefix
)
,
$this
->
createLogger
(
$servicePrefix
)
)
;
}
protected
function
createLoggerHandler
(
string
$servicePrefix
)
: Definition
{
return
(
new
Definition
(
RotatingFileHandler::
class
,
[
sprintf
(
'%%kernel.logs_dir%%/%s_%%kernel.environment%%.log',
$servicePrefix
)
,
sprintf
(
'%%%s%%',
$this
->
getParameterNameLoggerMaxFiles
(
$servicePrefix
)
)
,
sprintf
(
'%%%s%%',
$this
->
getParameterNameLogLevel
(
$servicePrefix
)
)
,
]
)
)
->
addMethodCall
(
'pushProcessor',
[
new
Reference
(
'monolog.processor.uid'
)
]
)
->
setPublic
(
false
)
;