• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

podio-community / podio-php / 5242896573

pending completion
5242896573

push

github

web-flow
Merge branch 'master' into 90-non-static-podio-class

2 of 2 new or added lines in 1 file covered. (100.0%)

917 of 2108 relevant lines covered (43.5%)

24.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/lib/PodioLogger.php
1
<?php
2

3
/**
4
 * Handles logging of errors and debug information to file system
5
 */
6
class PodioLogger
7
{
8
    protected $enabled = true;
9
    public $call_log = array();
10
    public $file;
11
    public $maxsize;
12

13
    public function __construct()
14
    {
15
        $this->file = dirname(__FILE__).'/../log/podio.log';
×
16
        $this->maxsize = 1024*1024;
×
17
    }
18

19
    public function disable()
20
    {
21
        $this->enabled = false;
×
22
    }
23

24
    public function enable()
25
    {
26
        $this->enabled = true;
×
27
    }
28

29
    public function log($text)
30
    {
31
        if (!is_dir(dirname($this->file))) {
×
32
            mkdir(dirname($this->file), 0777, true);
×
33
        }
34
        if ($fp = fopen($this->file, 'ab')) {
×
35
            fwrite($fp, $text);
×
36
            fclose($fp);
×
37

38
            // Trim log file by removing the first 50 lines
39
            if (filesize($this->file) > $this->maxsize) {
×
40
                $file = file($this->file);
×
41
                $file = array_splice($file, 0, 50);
×
42
                file_put_contents($this->file, join('', $file));
×
43
            }
44
        }
45
    }
46
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc