Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSR-3 Classes #1888

Merged
merged 7 commits into from Jan 23, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Implement missing critical() method
  • Loading branch information
sjinks committed Jan 23, 2014
commit f06ba8929f7ae0f859387c10f6896877bd948d2f
42 changes: 28 additions & 14 deletions ext/logger/adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ PHP_METHOD(Phalcon_Logger_Adapter, begin);
PHP_METHOD(Phalcon_Logger_Adapter, commit);
PHP_METHOD(Phalcon_Logger_Adapter, rollback);
PHP_METHOD(Phalcon_Logger_Adapter, emergency);
PHP_METHOD(Phalcon_Logger_Adapter, debug);
PHP_METHOD(Phalcon_Logger_Adapter, alert);
PHP_METHOD(Phalcon_Logger_Adapter, critical);
PHP_METHOD(Phalcon_Logger_Adapter, error);
PHP_METHOD(Phalcon_Logger_Adapter, info);
PHP_METHOD(Phalcon_Logger_Adapter, notice);
PHP_METHOD(Phalcon_Logger_Adapter, warning);
PHP_METHOD(Phalcon_Logger_Adapter, alert);
PHP_METHOD(Phalcon_Logger_Adapter, notice);
PHP_METHOD(Phalcon_Logger_Adapter, info);
PHP_METHOD(Phalcon_Logger_Adapter, debug);
PHP_METHOD(Phalcon_Logger_Adapter, log);

static const zend_function_entry phalcon_logger_adapter_method_entry[] = {
Expand All @@ -62,15 +63,16 @@ static const zend_function_entry phalcon_logger_adapter_method_entry[] = {
PHP_ME(Phalcon_Logger_Adapter, begin, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, commit, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, rollback, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, emergency, arginfo_phalcon_logger_adapterinterface_emergency, ZEND_ACC_PUBLIC)
PHP_MALIAS(Phalcon_Logger_Adapter, emergence, emergency, arginfo_phalcon_logger_adapterinterface_emergency, ZEND_ACC_PUBLIC | ZEND_ACC_DEPRECATED)
PHP_ME(Phalcon_Logger_Adapter, log, arginfo_phalcon_logger_adapterinterface_log, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, debug, arginfo_phalcon_logger_adapterinterface_debug, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, error, arginfo_phalcon_logger_adapterinterface_error, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, info, arginfo_phalcon_logger_adapterinterface_info, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, notice, arginfo_phalcon_logger_adapterinterface_notice, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, warning, arginfo_phalcon_logger_adapterinterface_warning, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, error, arginfo_phalcon_logger_adapterinterface_error, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, critical, arginfo_phalcon_logger_adapterinterface_critical, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, alert, arginfo_phalcon_logger_adapterinterface_alert, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, log, arginfo_phalcon_logger_adapterinterface_log, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Logger_Adapter, emergency, arginfo_phalcon_logger_adapterinterface_emergency, ZEND_ACC_PUBLIC)
ZEND_FENTRY(logInternal, NULL, arginfo_phalcon_logger_adapter_loginternal, ZEND_ACC_PROTECTED | ZEND_ACC_ABSTRACT)
PHP_FE_END
};
Expand Down Expand Up @@ -323,7 +325,7 @@ static void phalcon_logger_adapter_log_helper(INTERNAL_FUNCTION_PARAMETERS, int
*
* @param string $message
* @param array $context
* @return Phalcon\Logger\Adapter
* @return Phalcon\Logger\AdapterInterface
*/
PHP_METHOD(Phalcon_Logger_Adapter, emergency){

Expand All @@ -335,7 +337,7 @@ PHP_METHOD(Phalcon_Logger_Adapter, emergency){
*
* @param string $message
* @param array $context
* @return Phalcon\Logger\Adapter
* @return Phalcon\Logger\AdapterInterface
*/
PHP_METHOD(Phalcon_Logger_Adapter, debug){

Expand All @@ -347,7 +349,7 @@ PHP_METHOD(Phalcon_Logger_Adapter, debug){
*
* @param string $message
* @param array $context
* @return Phalcon\Logger\Adapter
* @return Phalcon\Logger\AdapterInterface
*/
PHP_METHOD(Phalcon_Logger_Adapter, error){

Expand All @@ -359,7 +361,7 @@ PHP_METHOD(Phalcon_Logger_Adapter, error){
*
* @param string $message
* @param array $context
* @return Phalcon\Logger\Adapter
* @return Phalcon\Logger\AdapterInterface
*/
PHP_METHOD(Phalcon_Logger_Adapter, info){

Expand All @@ -371,7 +373,7 @@ PHP_METHOD(Phalcon_Logger_Adapter, info){
*
* @param string $message
* @param array $context
* @return Phalcon\Logger\Adapter
* @return Phalcon\Logger\AdapterInterface
*/
PHP_METHOD(Phalcon_Logger_Adapter, notice){

Expand All @@ -383,7 +385,7 @@ PHP_METHOD(Phalcon_Logger_Adapter, notice){
*
* @param string $message
* @param array $context
* @return Phalcon\Logger\Adapter
* @return Phalcon\Logger\AdapterInterface
*/
PHP_METHOD(Phalcon_Logger_Adapter, warning){

Expand All @@ -395,13 +397,25 @@ PHP_METHOD(Phalcon_Logger_Adapter, warning){
*
* @param string $message
* @param array $context
* @return Phalcon\Logger\Adapter
* @return Phalcon\Logger\AdapterInterface
*/
PHP_METHOD(Phalcon_Logger_Adapter, alert){

phalcon_logger_adapter_log_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHALCON_LOGGER_ALERT);
}

/**
* Sends/Writes a critical message to the log
*
* @param string $message
* @param array $context
* @return Phalcon\Logger\AdapterInterface
*/
PHP_METHOD(Phalcon_Logger_Adapter, critical){

phalcon_logger_adapter_log_helper(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHALCON_LOGGER_CRITICAL);
}

/**
* Logs messages to the internal logger. Appends messages to the log
*
Expand Down
65 changes: 42 additions & 23 deletions ext/logger/adapterinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ static const zend_function_entry phalcon_logger_adapterinterface_method_entry[]
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, getFormatter, NULL)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, setLogLevel, arginfo_phalcon_logger_adapterinterface_setloglevel)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, getLogLevel, NULL)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, log, arginfo_phalcon_logger_adapterinterface_log)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, begin, NULL)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, commit, NULL)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, rollback, NULL)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, close, NULL)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, log, arginfo_phalcon_logger_adapterinterface_log)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, debug, arginfo_phalcon_logger_adapterinterface_debug)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, error, arginfo_phalcon_logger_adapterinterface_error)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, info, arginfo_phalcon_logger_adapterinterface_info)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, notice, arginfo_phalcon_logger_adapterinterface_notice)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, warning, arginfo_phalcon_logger_adapterinterface_warning)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, error, arginfo_phalcon_logger_adapterinterface_error)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, critical, arginfo_phalcon_logger_adapterinterface_critical)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, alert, arginfo_phalcon_logger_adapterinterface_alert)
PHP_ABSTRACT_ME(Phalcon_Logger_AdapterInterface, emergency, arginfo_phalcon_logger_adapterinterface_emergency)
PHP_FE_END
Expand Down Expand Up @@ -85,9 +86,10 @@ PHALCON_DOC_METHOD(Phalcon_Logger_AdapterInterface, getLogLevel);
/**
* Sends/Writes messages to the file log
*
* @param int|string $type
* @param string $message
* @param int $type
* @return Phalcon\Logger\Adapter
* @param array $context
* @return Phalcon\Logger\AdapterInterface
*/
PHALCON_DOC_METHOD(Phalcon_Logger_AdapterInterface, log);

Expand Down Expand Up @@ -123,52 +125,69 @@ PHALCON_DOC_METHOD(Phalcon_Logger_AdapterInterface, close);
* Sends/Writes a debug message to the log
*
* @param string $message
* @param ing $type
* @return Phalcon\Logger\Adapter
* @param array $context
* @return Phalcon\Logger\AdapterInterface
*/
PHALCON_DOC_METHOD(Phalcon_Logger_AdapterInterface, debug);

/**
* Sends/Writes an error message to the log
*
* @param string $message
* @param ing $type
* @return Phalcon\Logger\Adapter
*/
PHALCON_DOC_METHOD(Phalcon_Logger_AdapterInterface, error);

/**
* Sends/Writes an info message to the log
*
* @param string $message
* @param ing $type
* @return Phalcon\Logger\Adapter
* @param array $context
* @return Phalcon\Logger\AdapterInterface
*/
PHALCON_DOC_METHOD(Phalcon_Logger_AdapterInterface, info);

/**
* Sends/Writes a notice message to the log
*
* @param string $message
* @param ing $type
* @return Phalcon\Logger\Adapter
* @return Phalcon\Logger\AdapterInterface
*/
PHALCON_DOC_METHOD(Phalcon_Logger_AdapterInterface, notice);

/**
* Sends/Writes a warning message to the log
*
* @param string $message
* @param ing $type
* @return Phalcon\Logger\Adapter
* @param array $context
* @return Phalcon\Logger\AdapterInterface
*/
PHALCON_DOC_METHOD(Phalcon_Logger_AdapterInterface, warning);

/**
* Sends/Writes an error message to the log
*
* @param string $message
* @param array $context
* @return Phalcon\Logger\AdapterInterface
*/
PHALCON_DOC_METHOD(Phalcon_Logger_AdapterInterface, error);

/**
* Sends/Writes a critical message to the log
*
* @param string $message
* @param array $context
* @return Phalcon\Logger\AdapterInterface
*/
PHALCON_DOC_METHOD(Phalcon_Logger_AdapterInterface, critical);

/**
* Sends/Writes an alert message to the log
*
* @param string $message
* @param ing $type
* @return Phalcon\Logger\Adapter
* @param array $context
* @return Phalcon\Logger\AdapterInterface
*/
PHALCON_DOC_METHOD(Phalcon_Logger_AdapterInterface, alert);

/**
* Sends/Writes an emergency message to the log
*
* @param string $message
* @param array $context
* @return Phalcon\Logger\AdapterInterface
*/
PHALCON_DOC_METHOD(Phalcon_Logger_AdapterInterface, emergency);
5 changes: 5 additions & 0 deletions ext/logger/adapterinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_logger_adapterinterface_warning, 0, 0, 1)
ZEND_ARG_ARRAY_INFO(0, context, 1)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_logger_adapterinterface_critical, 0, 0, 1)
ZEND_ARG_INFO(0, message)
ZEND_ARG_ARRAY_INFO(0, context, 1)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_logger_adapterinterface_alert, 0, 0, 1)
ZEND_ARG_INFO(0, message)
ZEND_ARG_ARRAY_INFO(0, context, 1)
Expand Down