This repository was archived by the owner on Mar 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathlogger.api.php
More file actions
58 lines (51 loc) · 1.39 KB
/
Copy pathlogger.api.php
File metadata and controls
58 lines (51 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* @file
* Hooks provided by the Logger module.
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Log a system event.
*
* This hook allows modules to log events to custom facilities, such as StatsD.
*
* @param string $name
* The name of the event to log.
* @param string $type
* The type of metric to log--one of the following values corresponding to the
* @link https://github.com/etsy/statsd/blob/master/docs/metric_types.md StatsD Metric Types @endlink
* :
* - count: The corresponding value is a number by which to increment (or
* decrement, if negative) a simple counter.
* - gauge: The corresponding value is a single datum, which remains constant
* until explicitly changed.
* - set: The corresponding value is a value to add to a set of unique values.
* - time: The corresponding value is a duration in milliseconds.
* @param int $value
* The numeric value you wish to log.
*
* @see logger_event()
*/
function hook_logger_event($name, $type, $value) {
// Send the metric to StatsD.
switch ($type) {
case 'count':
StatsD::updateStats($name, $value);
break;
case 'gauge':
StatsD::gauge($name, $value);
break;
case 'time':
StatsD::timing($name, $value);
break;
case 'set':
// The StatsD module does not currently support the "set" type.
break;
}
}
/**
* @} End of "addtogroup hooks".
*/