~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to lib/Xmds/LogProcessor.php

  • Committer: Dan Garner
  • Date: 2015-03-26 14:08:33 UTC
  • Revision ID: git-v1:70d14044444f8dc5d602b99890d59dea46d9470c
Moved web servable files to web folder

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
/*
3
 
 * Spring Signage Ltd - http://www.springsignage.com
4
 
 * Copyright (C) 2015 Spring Signage Ltd
5
 
 * (LogProcessor.php)
6
 
 */
7
 
 
8
 
 
9
 
namespace Xibo\Xmds;
10
 
 
11
 
use Slim\Log;
12
 
 
13
 
/**
14
 
 * Class LogProcessor
15
 
 * @package Xibo\Xmds
16
 
 */
17
 
class LogProcessor
18
 
{
19
 
    /** @var  Log */
20
 
    private $log;
21
 
    private $displayId;
22
 
    private $route;
23
 
    private $method;
24
 
    private $uid;
25
 
 
26
 
    /**
27
 
     * Log Processor
28
 
     * @param Log $log
29
 
     * @param string $method
30
 
     */
31
 
    public function __construct($log, $uid, $method = 'POST')
32
 
    {
33
 
        $this->log = $log;
34
 
        $this->uid = $uid;
35
 
        $this->method = $method;
36
 
    }
37
 
 
38
 
    /**
39
 
     * @param $route
40
 
     */
41
 
    public function setRoute($route)
42
 
    {
43
 
        $this->route = $route;
44
 
    }
45
 
 
46
 
    /**
47
 
     * @param $displayId
48
 
     * @param bool $isAuditing
49
 
     */
50
 
    public function setDisplay($displayId, $isAuditing)
51
 
    {
52
 
        if ($isAuditing)
53
 
            $this->log->setLevel(\Xibo\Service\LogService::resolveLogLevel('debug'));
54
 
 
55
 
        $this->displayId = $displayId;
56
 
    }
57
 
 
58
 
    /**
59
 
     * Get Log Level
60
 
     * @return int
61
 
     */
62
 
    public function getLevel()
63
 
    {
64
 
        return $this->log->getLevel();
65
 
    }
66
 
 
67
 
    /**
68
 
     * Get UID
69
 
     * @return string
70
 
     */
71
 
    public function getUid()
72
 
    {
73
 
        return $this->uid;
74
 
    }
75
 
 
76
 
    /**
77
 
     * @param array $record
78
 
     * @return array
79
 
     */
80
 
    public function __invoke(array $record)
81
 
    {
82
 
        $record['extra']['displayId'] = $this->displayId;
83
 
        $record['extra']['route'] = $this->route;
84
 
        $record['extra']['method'] = $this->method;
85
 
 
86
 
        return $record;
87
 
    }
88
 
}
 
 
b'\\ No newline at end of file'