Plugin Directory

Changeset 1849172


Ignore:
Timestamp:
03/29/2018 10:08:57 AM (8 years ago)
Author:
Zoomd
Message:

Coralogix
new Sitemanager

Location:
zoomd-search/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • zoomd-search/trunk/classes/Core/Logger.php

    r1845082 r1849172  
    1111        public $logLevel = 1; //0=info , 1=Warn , 2=Error
    1212
    13         public function __construct(){                       
    14             $this->logLevel = defaultloglevel;           
     13        public function __construct(){                   
     14            $this->logLevel = defaultloglevel;
    1515            $lvl = get_transient('zoomd_loglevel');                                   
     16
     17                         
    1618            if(isset($lvl) && is_numeric($lvl))
    1719            {                   
     
    2224        public function Info($msg){           
    2325            if($this->logLevel == 0)
    24                 $this->log($msg,"Info");
     26                $this->log($msg,3);
    2527        }
    2628
    27         public function Warn($msg){
     29        public function Warn($msg){           
    2830            if($this->logLevel <= 1)
    29                 $this->log($msg,"Warn");
     31                $this->log($msg,4);
    3032        }
    3133
    3234        public function Error($msg){
    3335            if($this->logLevel <= 2)
    34                 $this->log($msg,"Error");       
     36                $this->log($msg,5);       
    3537        }
    3638
    37         public function log($msg,$level = "Info")
     39        public function log($msg,$level = 3)
    3840        {
    3941            try
     
    4244                if(!$this->isJson($msg))
    4345                {
    44                     $data = array("message" => $msg, "level" => $level);                                                                   
     46                    $data = array("message" => $msg);
    4547                    $data_string = json_encode($data);                 
    4648                }
    47                 $data_string = $this->enrichlogmsg($data_string);
    48 
    49                 $this->post_async(logglyUrl,$data_string);
     49                $data_string = $this->enrichlogmsg($data_string,$level);
     50                $this->post_async(loggerUrl,$data_string);
    5051
    5152                $siteUrl = Settings::siteUrl();
    52                 if(defined( 'Zoomd_DBG' )  && (substr($siteUrl,0,strlen(localhost)) == localhost))
    53                 {
    54                     error_log($data_string);                   
    55                 }
    56                 //     $this->post_async(localLogUrl, $data_string);
    5753            }
    5854            catch (Exception $e)
     
    6460        private function post_async($url, $post_string)
    6561        {
    66             //echo $post_string;
     62            $res = "";
    6763            $parts=parse_url($url);
    68 
    69             $fp = fsockopen($parts['host'],
    70                 isset($parts['port'])?$parts['port']:80,
    71                 $errno, $errstr, 30);
    72 
    73             $out = "POST ".$parts['path']." HTTP/1.1\r\n";
     64            $fp = fsockopen("ssl://".$parts['host'],443,$errno, $errstr, 30);
     65           
     66            $out = "POST ".$url." HTTP/1.1\r\n";
    7467            $out.= "Host: ".$parts['host']."\r\n";
    7568            $out.= "Content-Type: application/json\r\n";
     
    7770            $out.= "Connection: Close\r\n\r\n";
    7871            if (isset($post_string)) $out.= $post_string;
    79 
    8072            fwrite($fp, $out);
    81             fclose($fp);
     73            fclose($fp);           
    8274        }
    8375
    84         private function enrichlogmsg($msg)
     76        private function enrichlogmsg($msg,$lvl)
    8577        {
    86             $jsonobj = json_decode($msg);
    87             $jsonobj->siteid = Settings::siteId();
    88             $jsonobj->url = Settings::siteUrl();
    89             $jsonobj->clientid = Settings::clientId();
    90             $jsonobj->lastindexed = Settings::lastIndex();
    91             $jsonobj->environment = Settings::environment();
    92             $jsonobj->email = Settings::email();
    93 
    94             return json_encode($jsonobj);
     78            $result = json_decode("{}");
     79            $result->privateKey = "98d36d56-a8ff-75a6-1fd2-389a76edf768";
     80            $result->applicationName = Settings::environment();           
     81            $result->subsystemName = "Wordpress";
     82            $result->computerName = gethostname();
     83           
     84            $le = array(
     85                 array(
     86                           "timestamp" => microtime(true) * 1000,
     87                           "severity" => $lvl,
     88                           "siteid" => Settings::siteId(),
     89                           "url" => Settings::siteUrl(),
     90                           "clientid" => Settings::clientId(),
     91                           "lastindexed" => Settings::lastIndex(),
     92                           "environment" => Settings::environment(),
     93                           "email" => Settings::email(),                           
     94                           "text" => json_decode($msg)
     95                 )
     96              );     
     97           
     98            $result->logEntries = $le;
     99            return json_encode($result);
    95100        }
    96101
  • zoomd-search/trunk/classes/zoomd_constants.php

    r1845082 r1849172  
    44
    55const baseURL = 'http://zadmin.zoomd.com';
     6
    67const widgetbaseURL = 'zsearch.zoomd.com';
    78
     
    1920const ValidationEndpoint = ValidateEndpointVal;
    2021const RegistrationEndPoint = RegistrationEndpointVal;
    21 const logglyUrl = 'https://logs-01.loggly.com/bulk/2f471b20-4cdf-4a0b-ba5b-dcaeb14206d2/tag/WordPress';
     22
     23const loggerUrl = 'https://api.coralogix.com/api/v1/logs';
    2224
    2325
  • zoomd-search/trunk/readme.txt

    r1845082 r1849172  
    4646= 2.1.0.37 =
    4747* 4.9.4 update
     48* General Improvements
    4849* Bug Fixes
    4950
Note: See TracChangeset for help on using the changeset viewer.