Skip to content

Commit c375ba2

Browse files
author
David Castro
committed
INT-16722: Disabled logging for redislock for web.
Resolves #11
1 parent 3b06b75 commit c375ba2

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Set:
1919

2020
## Flags
2121

22-
* Use the boolean flag `$CFG->local_redislock_logging` to control whether verbose
23-
logging should be emitted. If not set, logging is automatically-enabled when running
24-
in the CLI environment with debugging enabled on `DEBUG_NORMAL` level at least.
22+
* Logging is only available in the CLI environment with debugging enabled on `DEBUG_NORMAL` level at least.
23+
Use the boolean flag `$CFG->local_redislock_logging` to control whether verbose
24+
logging should be emitted. If not set, logging is automatically-enabled.
2525
* Use the boolean flag `$CFG->local_redislock_disable_shared_connection` to force creation
2626
of the redis connection for each factory instance.

classes/api/shared_redis_connection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ class shared_redis_connection {
6565
*/
6666
private function __construct() {
6767
$this->factorycount = 0;
68+
// Logging enabled only for CLI, web gets damaged by lock logs.
69+
$this->logging = (CLI_SCRIPT && debugging() && !PHPUNIT_TEST);
6870
if (isset($CFG->local_redislock_logging)) {
69-
$this->logging = (bool) $CFG->local_redislock_logging;
70-
} else {
71-
$this->logging = (CLI_SCRIPT && debugging() && !PHPUNIT_TEST);
71+
$this->logging = $this->logging && ((bool) $CFG->local_redislock_logging);
7272
}
7373
}
7474

classes/lock/redis_lock_factory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ public function __construct($type, \Redis $redis = null, $logging = null) {
102102
$this->shareconnection = false;
103103
}
104104
if (is_null($logging)) {
105+
// Logging enabled only for CLI, web gets damaged by lock logs.
106+
$logging = (CLI_SCRIPT && debugging() && !PHPUNIT_TEST);
105107
if (isset($CFG->local_redislock_logging)) {
106-
$logging = (bool) $CFG->local_redislock_logging;
107-
} else {
108-
$logging = (CLI_SCRIPT && debugging() && !PHPUNIT_TEST);
108+
$logging = $this->logging && ((bool) $CFG->local_redislock_logging);
109109
}
110110
}
111111
$this->redis = $redis;

0 commit comments

Comments
 (0)