mirror of
https://github.com/macintoshplus/doc-fr.git
synced 2026-03-30 04:42:24 +02:00
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@167785 c90b9560-bf6c-de11-be94-00142212c4b1
151 lines
4.4 KiB
XML
151 lines
4.4 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.9 $ -->
|
|
<!-- EN-Revision: 1.6 Maintainer: yannick Status: ready -->
|
|
<refentry id="function.syslog">
|
|
<refnamediv>
|
|
<refname>syslog</refname>
|
|
<refpurpose>
|
|
Génère un message dans l'historique système
|
|
</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>syslog</methodname>
|
|
<methodparam><type>int</type><parameter>priority</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>message</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>syslog</function> génère un message qui
|
|
sera inscrit dans l'historique par le système.
|
|
<parameter>priority</parameter> est une combinaison des valeurs
|
|
d'accès et de niveau, qui seront décrites dans la
|
|
prochaine section. Le dernier argument est le message
|
|
à envoyer. Attention : les caractères <literal>%m</literal>
|
|
seront remplacés par l'erreur (sous forme de chaîne),
|
|
présente dans <errortype>errno</errortype>.
|
|
</para>
|
|
<para>
|
|
<table>
|
|
<title>Priorités <function>syslog</function>(en ordre décroissant)</title>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>Constante</entry>
|
|
<entry>Description</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>LOG_EMERG</entry>
|
|
<entry>système inutilisable</entry>
|
|
</row>
|
|
<row>
|
|
<entry>LOG_ALERT</entry>
|
|
<entry>une décision doit être prise immédiatement</entry>
|
|
</row>
|
|
<row>
|
|
<entry>LOG_CRIT</entry>
|
|
<entry>conditions critiques</entry>
|
|
</row>
|
|
<row>
|
|
<entry>LOG_ERR</entry>
|
|
<entry>conditions d'erreur</entry>
|
|
</row>
|
|
<row>
|
|
<entry>LOG_WARNING</entry>
|
|
<entry>conditions d'alerte</entry>
|
|
</row>
|
|
<row>
|
|
<entry>LOG_NOTICE</entry>
|
|
<entry>condition normale, mais significative</entry>
|
|
</row>
|
|
<row>
|
|
<entry>LOG_INFO</entry>
|
|
<entry>message d'information</entry>
|
|
</row>
|
|
<row>
|
|
<entry>LOG_DEBUG</entry>
|
|
<entry>message de débogage</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</table>
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>Utilisation de <function>syslog</function></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
define_syslog_variables();
|
|
// ouverture de syslog, ajout du PID et envoi simultané du
|
|
// message à la sortie standard et à un mécanisme
|
|
// spécifique
|
|
openlog("myScriptLog", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
|
|
|
// quelques lignes de code
|
|
|
|
if (authorized_client()) {
|
|
// faire quelquechose
|
|
} else {
|
|
// client non autorisé!
|
|
// notation de la tentative
|
|
$access = date("Y/m/d H:i:s");
|
|
syslog(LOG_WARNING, "Client non autorisé: $access $_SERVER[REMOTE_ADDR] ($_SERVER[HTTP_USER_AGENT])");
|
|
}
|
|
|
|
closelog();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
Pour plus d'informations sur comment mettre en place un gestionnaire
|
|
d'historique, reportez-vous au manuel Unix, page 5
|
|
<citerefentry><refentrytitle>syslog.conf</refentrytitle>
|
|
<manvolnum>5</manvolnum></citerefentry>. D'autres informations
|
|
sur les systèmes d'historique et leurs options sont aussi
|
|
disponibles dans le manuel <citerefentry><refentrytitle>syslog</refentrytitle>
|
|
<manvolnum>3</manvolnum></citerefentry> des machines Unix.
|
|
</para>
|
|
<para>
|
|
Avec Windows NT, l'historique est pris en charge par Event Log.
|
|
</para>
|
|
<note>
|
|
<para>
|
|
L'utilisation de <literal>LOG_LOCAL0</literal> à
|
|
<literal>LOG_LOCAL7</literal> pour le paramètre
|
|
<parameter>facility</parameter> de la fonction <function>openlog</function>
|
|
n'est pas disponible sous Windows.
|
|
</para>
|
|
</note>
|
|
<para>
|
|
Voir aussi
|
|
<function>define_syslog_variables</function>,
|
|
<function>openlog</function> et
|
|
<function>closelog</function>.
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|