GetLogger: различия между версиями

Материал из MajorDoMo инфо
Строка 2: Строка 2:
==Описание==
==Описание==
'''getLogger'''($context = null); -- Method returns logger with meaningful name. In this case much easy to enable\disable logs depending on requirements
'''getLogger'''($context = null); -- Method returns logger with meaningful name. In this case much easy to enable\disable logs depending on requirements
If $context is empty or null, then return root logger


If $context is filename or filepath, then return logger with name 'page.filename'
If $context is empty or null, then return root logger


If $context is string, then return logger with name $context
If $context is filename or filepath, then return logger with name 'page.filename'


If $context is object, then depending from object class it returns:
If $context is string, then return logger with name $context


  - 'class.object.objectname'
If $context is object, then depending from object class it returns:


  - 'class.module.modulename'
- 'class.object.objectname' 
- 'class.module.modulename'  
- 'class.objectclass' 


  - 'class.objectclass'
Example of usage:


   Example of usage:
- $log = getLogger();    
- $log = getLogger('MyLogger'); 
- $log = getLogger(__FILE__); 
- $log = getLogger($this);


  - $log = getLogger();
param mixed $context Context (default null)


  - $log = getLogger('MyLogger');
return Logger
 
  - $log = getLogger(__FILE__);
 
  - $log = getLogger($this);
 
  param mixed $context Context (default null)
 
  return Logger


==Примеры запросов==
==Примеры запросов==

Версия от 14:03, 11 декабря 2019

Описание

getLogger($context = null); -- Method returns logger with meaningful name. In this case much easy to enable\disable logs depending on requirements

If $context is empty or null, then return root logger

If $context is filename or filepath, then return logger with name 'page.filename'

If $context is string, then return logger with name $context

If $context is object, then depending from object class it returns:

- 'class.object.objectname' - 'class.module.modulename' - 'class.objectclass'

Example of usage:

- $log = getLogger(); - $log = getLogger('MyLogger'); - $log = getLogger(__FILE__); - $log = getLogger($this);

param mixed $context Context (default null)

return Logger

Примеры запросов

Альтернативные названия функции (сленг)

Просто для проверки появления разделов