Skip to content

Can't Control Log Level Easily Across Multiple Requests (Singleton problem) #186

Open
@HeathNaylor

Description

@HeathNaylor

After stepping through the code for Log.php I am seeing some code smell.

<?php
namespace net\authorize\util;

use net\authorize\util\ANetSensitiveFields;

define ("ANET_LOG_FILES_APPEND",true);

define("ANET_LOG_DEBUG_PREFIX","DEBUG");
define("ANET_LOG_INFO_PREFIX","INFO");
define("ANET_LOG_WARN_PREFIX","WARN");
define("ANET_LOG_ERROR_PREFIX","ERROR");

//log levels
define('ANET_LOG_DEBUG',1);
define("ANET_LOG_INFO",2);
define("ANET_LOG_WARN",3);
define("ANET_LOG_ERROR",4);

//set level
define("ANET_LOG_LEVEL",ANET_LOG_DEBUG);

First off, these are global constants in the application. As such if I attempt to set ANET_LOG_LEVEL during bootstrapping of the applications I will end up throwing a PHP noitce for the constant already being defined when the class is included later in the application.

As such all of these global variables should be member properties and a method of assigning a non-default value would need to be implemented.

Am I missing something, or is there not currently a way to define log level granularity?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions