简体   繁体   English

在我的名称空间中使用Monolog

[英]Use Monolog in my namespace

I want to integrate Monolog logger ( https://github.com/Seldaek/monolog ) to my own framework I have followed the PSR0 standard for structuring my framework so that namespacing is easy an follows the directory structure 我想将Monolog记录器( https://github.com/Seldaek/monolog )集成到我自己的框架中,我已遵循PSR0标准来构建框架,因此命名空间很容易,并且遵循目录结构

Now, I would like the logging to reside under Core/Logger directory, but Monolog uses its own namespace and I am wondering if I need to go and change its namespaces to match my structure? 现在,我希望日志记录位于Core / Logger目录下,但是Monolog使用它自己的名称空间,我想知道是否需要去更改其名称空间以匹配我的结构? I believe that I do not need to do that, but I think I am missing something. 我认为我不需要这样做,但是我想我缺少一些东西。

Is there a way to use it by just putting it under my Core/Logger dir and not change its own namespace? 是否可以通过将其放在我的Core / Logger目录下而不更改其自己的名称空间来使用它?

Thanks 谢谢

The short answer is no you can't put it in there without changing the namespace if you want to follow PSR-0. 简短的答案是,如果要遵循PSR-0,则不能在不更改名称空间的情况下将其放入其中。

The longer answer is that you should really use composer to pull in the monolog files and then they'll happily live in the vendor/ directory and be autoloadable and you should not have to care where they reside on the filesystem. 更长的答案是,您应该真正使用composer来提取monolog文件,然后它们将愉快地存在于vendor /目录中并且可以自动加载,并且您不必关心它们在文件系统上的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM