\AmfphpMonitor

logs monitoring information, and makes it possible to toggle logging and retrieve the data via the AmfphpMonitorService.

If the log file is not writable or its size is superior to maxLogFileSize, logging shall fail silently. This is designed to avoid errors being generated when a developer forgets to turn off monitoring, and to allow the plugin to be enabled by default

The log file is by default at [AmfphpMonitor plugin folder]/log.txt.php To change this set 'logPath' in the config.

note: Logging multiple times with the same name is not possible!

Summary

Methods
Properties
Constants
__construct()
addTime()
filterServiceNames2ClassFindInfo()
filterDeserializedRequest()
filterDeserializedResponse()
filterSerializedResponse()
No public properties found
No constants found
No protected methods found
$logPath
$uri
$isException
$lastMeasuredTime
$times
$restrictAccess
$maxLogFileSize
N/A
No private methods found
No private properties found
N/A

Properties

$logPath

$logPath : string

path to log file. If it is publicly accessible

Type

string

$uri

$uri : string

service and method name. If they are multiple calls in request, they are spearated with a ', '

Type

string

$isException

$isException : boolean

was there an exception during service call.

todo. unused.

Type

boolean

$lastMeasuredTime

$lastMeasuredTime : float

last measured time, or start time

Type

float

$times

$times : array

various times. for example ['startD' => 12 , 'stopD' => 30 ] means start of deserialization at 12 ms after the request was received, and end of deserialization 30 ms after start of deserialization.

Type

array

$restrictAccess

$restrictAccess : boolean

restrict access to amfphp_admin, the role set when using the back office. default is true.

Type

boolean

$maxLogFileSize

$maxLogFileSize : integer

The maximum size of the log file, in bytes. Once the log is bigger than this, logging stops.

Note that this is not strict, it can overflow with the last log.

Type

integer

Methods

__construct()

__construct(array $config)

constructor.

manages log path. If file exists at log path, adds hooks for logging.

Parameters

array $config

addTime()

addTime(string $name)

measures time since previous call (or start time time if this the first call) , and stores it in the times array public and static so that services can call this too to add custom times.

updates lastMeasuredTime

Parameters

string $name

filterServiceNames2ClassFindInfo()

filterServiceNames2ClassFindInfo(array $serviceNames2ClassFindInfo)

add monitor service

Parameters

array $serviceNames2ClassFindInfo

associative array of key -> class find info

filterDeserializedRequest()

filterDeserializedRequest(mixed $deserializedRequest)

logs the time for end of deserialization, as well as grabs the target uris(service + method) as each request has its own format, the code here must handle all deserialized request structures.

if case not handled just don't set target uris, as data can still be useful even without them.

Parameters

mixed $deserializedRequest

filterDeserializedResponse()

filterDeserializedResponse(\packet $deserializedResponse)

logs the time for start of serialization

Parameters

\packet $deserializedResponse

filterSerializedResponse()

filterSerializedResponse(mixed $rawData)

logs the time for end of serialization and writes log ignores calls to Amfphp services (checks for 'Amfphp' at beginning of name) tries to get a lock on the file, and if not then just drops the log.

Parameters

mixed $rawData