错误:“在编译容器时,\\“ logger \”服务或别名已被删除或内联。您应该将其公开,或者直接停止使用容器,而改用依赖项注入。”
这是我的服务。yaml
services:
# default configuration for services in *this* file
_defaults:
autowire: true
autoconfigure: true
public: true
class: App\Services\PasswordHasher
arguments: ["%password_salt_user%", "@logger"]
public: true
personal_email_handler:
server_name_generator:
class: App\Services\ServerNameGenerator
arguments: ["%server_name_generator%", "@logger"]
public: true
shmp:
class: App\MasterApi\Services\Shmp
arguments: ["%shmp%", "@logger"]
public: true
tags:
- { name: monolog.logger, channel: shmp }
stats_token:
class: App\Services\StatsToken
arguments: ["%token.stats%", "@logger"]
public: true
webftp_token:
class: App\Services\WebftpToken
arguments: ["%token.webftp%", "@logger"]
public: true
lms_connector:
class: App\Services\LmsConnector
arguments: ["%lms%", "@logger"]
public: true
tags:
- { name: monolog.logger, channel: dreamcommerce }
示例服务lms_connector
<?php
namespace App\Services;
use Symfony\Bridge\Monolog\Logger;
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
use Symfony\Component\DependencyInjection\ContainerInterface;
class LmsConnector
{
/**
* @var \Psr\Log\LoggerAwareInterface Obiekt loggera
*/
protected $logger;
.
.
.
/**
* @param \Symfony\Bridge\Monolog\Logger $logger obiekt loggera
*/
public function __construct(array $config, Logger $logger)
{
$this->logger = $logger;
.
.
.
}
我不知道如何解决这个问题。你能帮我吗?