当前位置: 首页>>代码示例>>PHP>>正文


PHP logger函数代码示例

本文整理汇总了PHP中logger函数的典型用法代码示例。如果您正苦于以下问题:PHP logger函数的具体用法?PHP logger怎么用?PHP logger使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了logger函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send

 /**
  * Send a multipart/alternative message with Text and HTML versions
  *
  * @param fromName			name of the sender
  * @param fromEmail			email fo the sender
  * @param replyTo			replyTo address to direct responses
  * @param toEmail			destination email address
  * @param messageSubject	subject of the message
  * @param htmlVersion		html version of the message
  * @param textVersion		text only version of the message
  * @param additionalMailHeader	additions to the smtp mail header
  * @param optional uid      user id of the destination user
  */
 public static function send($params)
 {
     call_hooks('emailer_send_prepare', $params);
     $email_textonly = False;
     if (x($params, "uid")) {
         $email_textonly = get_pconfig($params['uid'], "system", "email_textonly");
     }
     $fromName = email_header_encode(html_entity_decode($params['fromName'], ENT_QUOTES, 'UTF-8'), 'UTF-8');
     $messageSubject = email_header_encode(html_entity_decode($params['messageSubject'], ENT_QUOTES, 'UTF-8'), 'UTF-8');
     // generate a mime boundary
     $mimeBoundary = rand(0, 9) . "-" . rand(10000000000, 99999999999) . "-" . rand(10000000000, 99999999999) . "=:" . rand(10000, 99999);
     // generate a multipart/alternative message header
     $messageHeader = $params['additionalMailHeader'] . "From: {$fromName} <{$params['fromEmail']}>\n" . "Reply-To: {$fromName} <{$params['replyTo']}>\n" . "MIME-Version: 1.0\n" . "Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\"";
     // assemble the final multipart message body with the text and html types included
     $textBody = chunk_split(base64_encode($params['textVersion']));
     $htmlBody = chunk_split(base64_encode($params['htmlVersion']));
     $multipartMessageBody = "--" . $mimeBoundary . "\n" . "Content-Type: text/plain; charset=UTF-8\n" . "Content-Transfer-Encoding: base64\n\n" . $textBody . "\n";
     if (!$email_textonly && !is_null($params['htmlVersion'])) {
         $multipartMessageBody .= "--" . $mimeBoundary . "\n" . "Content-Type: text/html; charset=UTF-8\n" . "Content-Transfer-Encoding: base64\n\n" . $htmlBody . "\n";
     }
     $multipartMessageBody .= "--" . $mimeBoundary . "--\n";
     // message ending
     // send the message
     $hookdata = array('to' => $params['toEmail'], 'subject' => $messageSubject, 'body' => $multipartMessageBody, 'headers' => $messageHeader);
     //echo "<pre>"; var_dump($hookdata); killme();
     call_hooks("emailer_send", $hookdata);
     $res = mail($hookdata['to'], $hookdata['subject'], $hookdata['body'], $hookdata['headers']);
     logger("header " . 'To: ' . $params['toEmail'] . "\n" . $messageHeader, LOGGER_DEBUG);
     logger("return value " . ($res ? "true" : "false"), LOGGER_DEBUG);
     return $res;
 }
开发者ID:ZerGabriel,项目名称:friendica,代码行数:44,代码来源:Emailer.php

示例2: search_ac_init

function search_ac_init(&$a)
{
    if (!local_channel()) {
        killme();
    }
    $start = x($_REQUEST, 'start') ? $_REQUEST['start'] : 0;
    $count = x($_REQUEST, 'count') ? $_REQUEST['count'] : 100;
    $search = x($_REQUEST, 'search') ? $_REQUEST['search'] : "";
    if (x($_REQUEST, 'query') && strlen($_REQUEST['query'])) {
        $search = $_REQUEST['query'];
    }
    // Priority to people searches
    if ($search) {
        $people_sql_extra = protect_sprintf(" AND `xchan_name` LIKE '%" . dbesc($search) . "%' ");
        $tag_sql_extra = protect_sprintf(" AND term LIKE '%" . dbesc($search) . "%' ");
    }
    $r = q("SELECT `abook_id`, `xchan_name`, `xchan_photo_s`, `xchan_url`, `xchan_addr` FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d \n\t\t{$people_sql_extra}\n\t\tORDER BY `xchan_name` ASC ", intval(local_channel()));
    $results = array();
    if ($r) {
        foreach ($r as $g) {
            $results[] = array("photo" => $g['xchan_photo_s'], "name" => '@' . $g['xchan_name'], "id" => $g['abook_id'], "link" => $g['xchan_url'], "label" => '', "nick" => '');
        }
    }
    $r = q("select distinct term, tid, url from term where type in ( %d, %d ) {$tag_sql_extra} group by term order by term asc", intval(TERM_HASHTAG), intval(TERM_COMMUNITYTAG));
    if (count($r)) {
        foreach ($r as $g) {
            $results[] = array("photo" => $a->get_baseurl() . '/images/hashtag.png', "name" => '#' . $g['term'], "id" => $g['tid'], "link" => $g['url'], "label" => '', "nick" => '');
        }
    }
    header("content-type: application/json");
    $o = array('start' => $start, 'count' => $count, 'items' => $results);
    echo json_encode($o);
    logger('search_ac: ' . print_r($x, true));
    killme();
}
开发者ID:TamirAl,项目名称:hubzilla,代码行数:35,代码来源:search_ac.php

示例3: read_json

 public function read_json($data)
 {
     if (!is_array($data)) {
         logger(' source data is not a array.');
         return;
     }
     foreach ($data as $value) {
         if ($value['audio']) {
             $audio = $value['audio'];
             if ($audio['title_photo']) {
                 $this->picArray[] = $audio['title_photo'];
             }
             if ($audio['content_photo']) {
                 $this->picArray[] = $audio['content_photo'];
             }
             if ($audio['wetsound_path']) {
                 $this->mp3Array[] = $audio['wetsound_path'];
             }
             if (isset($audio['addPicList'])) {
                 $addPicList = $audio['addPicList'];
                 if (!is_array($addPicList)) {
                     return;
                 }
                 foreach ($addPicList as $value) {
                     $this->picArray[] = $value['content_pic'];
                 }
             }
         }
     }
 }
开发者ID:pengzhengrong,项目名称:account,代码行数:30,代码来源:tourism_url_download.php

示例4: __construct

 public function __construct($dsn, $user, $password)
 {
     parent::__construct($dsn, $user, $password);
     $this->query("SET NAMES ´utf8´");
     $this->query("SET CHARACTER SET utf8");
     logger("INFO", "Database Class Initialized");
 }
开发者ID:emrecete,项目名称:fmr,代码行数:7,代码来源:Database.php

示例5: getFromRouter

 public static function getFromRouter(Router $router)
 {
     $mode = $router->getMode();
     $parameters = [];
     $path = preg_replace_callback('/\\/\\${.*}/U', function ($matches) use(&$parameters) {
         $parameters[] = preg_replace('/\\/|\\$|\\{|\\}/', '', $matches[0]);
         return '';
     }, $router->getPath());
     $patharr = array_merge(explode('/', $router->getBase()), explode('/', $path));
     $path = array_filter(array_map(function ($p) {
         return \camelCase($p, true, '-');
     }, $patharr));
     if ($mode === Router::MOD_RESTFUL) {
         $request = $router->getRequest();
         $method = strtoupper($_POST['_method'] ?? $request->getMethod());
         $action = $router->getActionOfRestful($method);
         if ($action === null) {
             throw new \Leno\Http\Exception(501);
         }
     } else {
         $action = preg_replace_callback('/^[A-Z]/', function ($matches) {
             if (isset($matches[0])) {
                 return strtolower($matches[0]);
             }
         }, preg_replace('/\\..*$/', '', array_pop($path)));
     }
     try {
         return (new self(implode('\\', $path) . 'Controller'))->setMethod($action)->setParameters($parameters);
     } catch (\Exception $ex) {
         logger()->err((string) $ex);
         throw new \Leno\Http\Exception(404);
     }
 }
开发者ID:hackyoung,项目名称:leno,代码行数:33,代码来源:Target.php

示例6: bookmarks_init

function bookmarks_init(&$a)
{
    if (!local_user()) {
        return;
    }
    $item_id = intval($_REQUEST['item']);
    if (!$item_id) {
        return;
    }
    $u = $a->get_channel();
    $i = q("select * from item where id = %d and uid = %d limit 1", intval($item_id), intval(local_user()));
    if (!$i) {
        return;
    }
    $i = fetch_post_tags($i);
    $item = $i[0];
    $terms = get_terms_oftype($item['term'], TERM_BOOKMARK);
    if ($terms && !$item['item_restrict']) {
        require_once 'include/bookmarks.php';
        $s = q("select * from xchan where xchan_hash = '%s' limit 1", dbesc($item['author_xchan']));
        if (!$s) {
            logger('mod_bookmarks: author lookup failed.');
            killme();
        }
        foreach ($terms as $t) {
            bookmark_add($u, $s[0], $t, $item['item_private']);
            info(t('Bookmark added') . EOL);
        }
    }
    killme();
}
开发者ID:Mauru,项目名称:red,代码行数:31,代码来源:bookmarks.php

示例7: servePostRequest

function servePostRequest($params)
{
    //logger("POST Params : ".print_r($params, true) );
    switch ($params['task']) {
        case 'UPDATE_MODULE':
            $ret = updateLineItem($params);
            break;
            // Handles the case when a module/project/item has to be marked complete. Identifiers in $params['identifier']
        // Handles the case when a module/project/item has to be marked complete. Identifiers in $params['identifier']
        case 'MARK_COMPLETE':
            $tmp = $params['identifier']['project_name'];
            $tmp_proj = new ProjectController();
            $tmp_proj->markAsComplete($params);
            logger("{$tmp} is COMPLETE");
            break;
            // Handles the case when a module/project/item is to be marked invalid. Identifiers in $params['identifier']
        // Handles the case when a module/project/item is to be marked invalid. Identifiers in $params['identifier']
        case 'MARK_DISABLED':
            $tmp = $params['identifier']['project_name'];
            $tmp_proj = new ProjectController();
            $tmp_proj->markAsInactive($params);
            logger("{$tmp} is INVALID");
            break;
        case 'NEW_PROJECT':
            $ret = addNewProject($params);
            //$ret = "New project initiated";
            break;
        default:
            # code...
            break;
    }
    return $ret;
}
开发者ID:pallavdiablo,项目名称:Panorama,代码行数:33,代码来源:webservice.php

示例8: init

 function init()
 {
     $result = array('success' => false);
     $mindate = $_REQUEST['mindate'] ? datetime_convert('UTC', 'UTC', $_REQUEST['mindate']) : '';
     if (!$mindate) {
         $mindate = datetime_convert('UTC', 'UTC', 'now - 14 days');
     }
     if (observer_prohibited()) {
         $result['message'] = 'Public access denied';
         json_return_and_die($result);
     }
     $observer = \App::get_observer();
     $channel_address = argc() > 1 ? argv(1) : '';
     if ($channel_address) {
         $r = q("select channel_id, channel_name from channel where channel_address = '%s' and channel_removed = 0 limit 1", dbesc(argv(1)));
     } else {
         $x = get_sys_channel();
         if ($x) {
             $r = array($x);
         }
         $mindate = datetime_convert('UTC', 'UTC', 'now - 14 days');
     }
     if (!$r) {
         $result['message'] = 'Channel not found.';
         json_return_and_die($result);
     }
     logger('zotfeed request: ' . $r[0]['channel_name'], LOGGER_DEBUG);
     $result['messages'] = zot_feed($r[0]['channel_id'], $observer['xchan_hash'], array('mindate' => $mindate));
     $result['success'] = true;
     json_return_and_die($result);
 }
开发者ID:BlaBlaNet,项目名称:hubzilla,代码行数:31,代码来源:Zotfeed.php

示例9: testHelpersFacade

 public function testHelpersFacade()
 {
     $this->assertInstanceOf(\Clarity\Support\Auth\Auth::class, auth());
     $this->assertInstanceOf(\Phalcon\Config::class, config());
     $this->assertInstanceOf(\Phalcon\Mvc\Dispatcher::class, dispatcher());
     $this->assertInstanceOf(\Phalcon\Filter::class, filter());
     $this->assertInstanceOf(\Phalcon\Flash\Direct::class, flash()->direct());
     $this->assertInstanceOf(\Phalcon\Flash\Session::class, flash()->session());
     $this->assertInstanceOf(\League\Flysystem\Filesystem::class, flysystem());
     $this->assertInstanceOf(\League\Flysystem\MountManager::class, flysystem_manager());
     $this->assertInstanceOf(\Clarity\Support\Redirect\Redirect::class, redirect());
     $this->assertInstanceOf(\Clarity\Support\Phalcon\Http\Request::class, request());
     $this->assertInstanceOf(\Phalcon\Http\Response::class, response());
     $this->assertInstanceOf(\Phalcon\Mvc\Router::class, route());
     $this->assertInstanceOf(\Phalcon\Security::class, security());
     $this->assertInstanceOf(\Phalcon\Tag::class, tag());
     $this->assertInstanceOf(\Phalcon\Mvc\Url::class, url());
     $this->assertInstanceOf(\Phalcon\Mvc\View::class, view());
     # getting an error, will check later on
     $this->assertInstanceOf(\Monolog\Logger::class, logger());
     # adapter base functions
     // $this->assertInstanceOf(, cache());
     // $this->assertInstanceOf(, db());
     // $this->assertInstanceOf(, queue());
     // $this->assertInstanceOf(, session());
     $this->assertContains(url()->getBaseUri() . 'auth/login', route('showLoginForm'));
     $this->assertInstanceOf(\Phalcon\Mvc\View::class, view('welcome'));
 }
开发者ID:phalconslayer,项目名称:framework,代码行数:28,代码来源:HelpersTest.php

示例10: notes_init

/** @file */
function notes_init(&$a)
{
    if (!local_channel()) {
        return;
    }
    $ret = array('success' => true);
    if (array_key_exists('note_text', $_REQUEST)) {
        $body = escape_tags($_REQUEST['note_text']);
        // I've had my notes vanish into thin air twice in four years.
        // Provide a backup copy if there were contents previously
        // and there are none being saved now.
        if (!$body) {
            $old_text = get_pconfig(local_channel(), 'notes', 'text');
            if ($old_text) {
                set_pconfig(local_channel(), 'notes', 'text.bak', $old_text);
            }
        }
        set_pconfig(local_channel(), 'notes', 'text', $body);
    }
    // push updates to channel clones
    if (argc() > 1 && argv(1) === 'sync') {
        require_once 'include/zot.php';
        build_sync_packet();
    }
    logger('notes saved.', LOGGER_DEBUG);
    json_return_and_die($ret);
}
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:28,代码来源:notes.php

示例11: pubsub_post

function pubsub_post(&$a)
{
    $xml = file_get_contents('php://input');
    logger('pubsub: feed arrived from ' . $_SERVER['REMOTE_ADDR'] . ' for ' . $a->cmd);
    logger('pubsub: user-agent: ' . $_SERVER['HTTP_USER_AGENT']);
    logger('pubsub: data: ' . $xml, LOGGER_DATA);
    //	if(! stristr($xml,'<?xml')) {
    //		logger('pubsub_post: bad xml');
    //		hub_post_return();
    //	}
    $nick = $a->argc > 1 ? notags(trim($a->argv[1])) : '';
    $contact_id = $a->argc > 2 ? intval($a->argv[2]) : 0;
    $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1", dbesc($nick));
    if (!count($r)) {
        hub_post_return();
    }
    $importer = $r[0];
    $r = q("SELECT * FROM `contact` WHERE `subhub` = 1 AND `id` = %d AND `uid` = %d \n\t\tAND ( `rel` = %d OR `rel` = %d OR network = '%s' ) AND `blocked` = 0 AND `readonly` = 0 LIMIT 1", intval($contact_id), intval($importer['uid']), intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND), dbesc(NETWORK_FEED));
    if (!count($r)) {
        logger('pubsub: no contact record for "' . $nick . ' (' . $contact_id . ')" - ignored. ' . $xml);
        hub_post_return();
    }
    $contact = $r[0];
    // we have no way to match Diaspora guid's with atom post id's and could get duplicates.
    // we'll assume that direct delivery is robust (and this is a bad assumption, but the duplicates are messy).
    if ($r[0]['network'] === NETWORK_DIASPORA) {
        hub_post_return();
    }
    $feedhub = '';
    require_once 'include/items.php';
    consume_feed($xml, $importer, $contact, $feedhub, 1, 1);
    // do it a second time so that any children find their parents.
    consume_feed($xml, $importer, $contact, $feedhub, 1, 2);
    hub_post_return();
}
开发者ID:jzacman,项目名称:friendica,代码行数:35,代码来源:pubsub.php

示例12: query

 function query($query)
 {
     if ($this->debug) {
         logger("DB:" . $this->name, "Query: " . substr($query, 0, $this->traceLength));
     }
     return parent::query($query);
 }
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:7,代码来源:db_Wrap.class.php

示例13: generateForm

 private function generateForm()
 {
     $fieldTemplate = $this->getTemplate($this->templatePath . 'form_field.blade');
     $fields = [];
     logger($this->fillableColumns);
     foreach ($this->fillableColumns as $column) {
         switch ($column['type']) {
             case 'integer':
                 $inputType = 'number';
                 break;
             case 'text':
                 $inputType = 'textarea';
                 break;
             case 'date':
                 $inputType = $column['type'];
                 break;
             case 'boolean':
                 $inputType = 'checkbox';
                 break;
             default:
                 $inputType = 'text';
                 break;
         }
         $fields[] = $this->compile($fieldTemplate, ['FIELD_NAME' => $column['field'], 'LABEL' => title_case(str_replace('_', ' ', $column['field'])), 'INPUT_TYPE' => $inputType]);
     }
     $templateData = $this->templateData;
     $templateData['FIELDS'] = implode("\n\n", $fields);
     $filename = 'form.blade.php';
     $this->generateFile($filename, $templateData, $this->templatePath . 'form.blade');
 }
开发者ID:19peaches,项目名称:laravel-generator,代码行数:30,代码来源:ViewGenerator.php

示例14: run

 public static function run($argc, $argv)
 {
     /**
      * Cron Weekly
      * 
      * Actions in the following block are executed once per day only on Sunday (once per week).
      *
      */
     call_hooks('cron_weekly', datetime_convert());
     z_check_cert();
     require_once 'include/hubloc.php';
     prune_hub_reinstalls();
     mark_orphan_hubsxchans();
     // get rid of really old poco records
     q("delete from xlink where xlink_updated < %s - INTERVAL %s and xlink_static = 0 ", db_utcnow(), db_quoteinterval('14 DAY'));
     $dirmode = intval(get_config('system', 'directory_mode'));
     if ($dirmode === DIRECTORY_MODE_SECONDARY || $dirmode === DIRECTORY_MODE_PRIMARY) {
         logger('regdir: ' . print_r(z_fetch_url(get_directory_primary() . '/regdir?f=&url=' . urlencode(z_root()) . '&realm=' . urlencode(get_directory_realm())), true));
     }
     // Check for dead sites
     Master::Summon(array('Checksites'));
     // update searchable doc indexes
     Master::Summon(array('Importdoc'));
     /**
      * End Cron Weekly
      */
 }
开发者ID:anmol26s,项目名称:hubzilla-yunohost,代码行数:27,代码来源:Cron_weekly.php

示例15: fromapp_uninstall

function fromapp_uninstall()
{
    unregister_hook('post_local', 'addon/fromapp/fromapp.php', 'fromapp_post_hook');
    unregister_hook('plugin_settings', 'addon/fromapp/fromapp.php', 'fromapp_settings');
    unregister_hook('plugin_settings_post', 'addon/fromapp/fromapp.php', 'fromapp_settings_post');
    logger("removed fromapp");
}
开发者ID:ZerGabriel,项目名称:friendica-addons,代码行数:7,代码来源:fromapp.php


注:本文中的logger函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。