summaryrefslogtreecommitdiff
path: root/devdocs/go/log%2Fsyslog%2Findex.html
diff options
context:
space:
mode:
Diffstat (limited to 'devdocs/go/log%2Fsyslog%2Findex.html')
-rw-r--r--devdocs/go/log%2Fsyslog%2Findex.html109
1 files changed, 109 insertions, 0 deletions
diff --git a/devdocs/go/log%2Fsyslog%2Findex.html b/devdocs/go/log%2Fsyslog%2Findex.html
new file mode 100644
index 00000000..e33c270c
--- /dev/null
+++ b/devdocs/go/log%2Fsyslog%2Findex.html
@@ -0,0 +1,109 @@
+<h1> Package syslog </h1> <ul id="short-nav">
+<li><code>import "log/syslog"</code></li>
+<li><a href="#pkg-overview" class="overviewLink">Overview</a></li>
+<li><a href="#pkg-index" class="indexLink">Index</a></li>
+<li><a href="#pkg-examples" class="examplesLink">Examples</a></li>
+</ul> <h2 id="pkg-overview">Overview </h2> <p>Package syslog provides a simple interface to the system log service. It can send messages to the syslog daemon using UNIX domain sockets, UDP or TCP. </p>
+<p>Only one call to Dial is necessary. On write failures, the syslog client will attempt to reconnect to the server and write again. </p>
+<p>The syslog package is frozen and is not accepting new features. Some external packages provide more functionality. See: </p>
+<pre data-language="go">https://godoc.org/?q=syslog
+</pre> <h2 id="pkg-index">Index </h2> <ul id="manual-nav">
+<li><a href="#NewLogger">func NewLogger(p Priority, logFlag int) (*log.Logger, error)</a></li>
+<li><a href="#Priority">type Priority</a></li>
+<li><a href="#Writer">type Writer</a></li>
+<li> <a href="#Dial">func Dial(network, raddr string, priority Priority, tag string) (*Writer, error)</a>
+</li>
+<li> <a href="#New">func New(priority Priority, tag string) (*Writer, error)</a>
+</li>
+<li> <a href="#Writer.Alert">func (w *Writer) Alert(m string) error</a>
+</li>
+<li> <a href="#Writer.Close">func (w *Writer) Close() error</a>
+</li>
+<li> <a href="#Writer.Crit">func (w *Writer) Crit(m string) error</a>
+</li>
+<li> <a href="#Writer.Debug">func (w *Writer) Debug(m string) error</a>
+</li>
+<li> <a href="#Writer.Emerg">func (w *Writer) Emerg(m string) error</a>
+</li>
+<li> <a href="#Writer.Err">func (w *Writer) Err(m string) error</a>
+</li>
+<li> <a href="#Writer.Info">func (w *Writer) Info(m string) error</a>
+</li>
+<li> <a href="#Writer.Notice">func (w *Writer) Notice(m string) error</a>
+</li>
+<li> <a href="#Writer.Warning">func (w *Writer) Warning(m string) error</a>
+</li>
+<li> <a href="#Writer.Write">func (w *Writer) Write(b []byte) (int, error)</a>
+</li>
+<li><a href="#pkg-note-BUG">Bugs</a></li>
+</ul> <div id="pkg-examples"> <h3>Examples</h3> <dl> <dd><a class="exampleLink" href="#example_Dial">Dial</a></dd> </dl> </div> <h3>Package files</h3> <p> <span>doc.go</span> <span>syslog.go</span> <span>syslog_unix.go</span> </p> <h2 id="NewLogger">func <span>NewLogger</span> </h2> <pre data-language="go">func NewLogger(p Priority, logFlag int) (*log.Logger, error)</pre> <p>NewLogger creates a <span>log.Logger</span> whose output is written to the system log service with the specified priority, a combination of the syslog facility and severity. The logFlag argument is the flag set passed through to <span>log.New</span> to create the Logger. </p>
+<h2 id="Priority">type <span>Priority</span> </h2> <p>The Priority is a combination of the syslog facility and severity. For example, <a href="#LOG_ALERT">LOG_ALERT</a> | <a href="#LOG_FTP">LOG_FTP</a> sends an alert severity message from the FTP facility. The default severity is <a href="#LOG_EMERG">LOG_EMERG</a>; the default facility is <a href="#LOG_KERN">LOG_KERN</a>. </p>
+<pre data-language="go">type Priority int</pre> <pre data-language="go">const (
+
+ // From /usr/include/sys/syslog.h.
+ // These are the same on Linux, BSD, and OS X.
+ LOG_EMERG Priority = iota
+ LOG_ALERT
+ LOG_CRIT
+ LOG_ERR
+ LOG_WARNING
+ LOG_NOTICE
+ LOG_INFO
+ LOG_DEBUG
+)</pre> <pre data-language="go">const (
+
+ // From /usr/include/sys/syslog.h.
+ // These are the same up to LOG_FTP on Linux, BSD, and OS X.
+ LOG_KERN Priority = iota &lt;&lt; 3
+ LOG_USER
+ LOG_MAIL
+ LOG_DAEMON
+ LOG_AUTH
+ LOG_SYSLOG
+ LOG_LPR
+ LOG_NEWS
+ LOG_UUCP
+ LOG_CRON
+ LOG_AUTHPRIV
+ LOG_FTP
+
+ LOG_LOCAL0
+ LOG_LOCAL1
+ LOG_LOCAL2
+ LOG_LOCAL3
+ LOG_LOCAL4
+ LOG_LOCAL5
+ LOG_LOCAL6
+ LOG_LOCAL7
+)</pre> <h2 id="Writer">type <span>Writer</span> </h2> <p>A Writer is a connection to a syslog server. </p>
+<pre data-language="go">type Writer struct {
+ // contains filtered or unexported fields
+}
+</pre> <h3 id="Dial">func <span>Dial</span> </h3> <pre data-language="go">func Dial(network, raddr string, priority Priority, tag string) (*Writer, error)</pre> <p>Dial establishes a connection to a log daemon by connecting to address raddr on the specified network. Each write to the returned writer sends a log message with the facility and severity (from priority) and tag. If tag is empty, the <span>os.Args</span>[0] is used. If network is empty, Dial will connect to the local syslog server. Otherwise, see the documentation for net.Dial for valid values of network and raddr. </p> <h4 id="example_Dial"> <span class="text">Example</span>
+</h4> <p>Code:</p> <pre class="code" data-language="go">
+sysLog, err := syslog.Dial("tcp", "localhost:1234",
+ syslog.LOG_WARNING|syslog.LOG_DAEMON, "demotag")
+if err != nil {
+ log.Fatal(err)
+}
+fmt.Fprintf(sysLog, "This is a daemon warning with demotag.")
+sysLog.Emerg("And this is a daemon emergency with demotag.")
+</pre> <h3 id="New">func <span>New</span> </h3> <pre data-language="go">func New(priority Priority, tag string) (*Writer, error)</pre> <p>New establishes a new connection to the system log daemon. Each write to the returned writer sends a log message with the given priority (a combination of the syslog facility and severity) and prefix tag. If tag is empty, the <span>os.Args</span>[0] is used. </p>
+<h3 id="Writer.Alert">func (*Writer) <span>Alert</span> </h3> <pre data-language="go">func (w *Writer) Alert(m string) error</pre> <p>Alert logs a message with severity <a href="#LOG_ALERT">LOG_ALERT</a>, ignoring the severity passed to New. </p>
+<h3 id="Writer.Close">func (*Writer) <span>Close</span> </h3> <pre data-language="go">func (w *Writer) Close() error</pre> <p>Close closes a connection to the syslog daemon. </p>
+<h3 id="Writer.Crit">func (*Writer) <span>Crit</span> </h3> <pre data-language="go">func (w *Writer) Crit(m string) error</pre> <p>Crit logs a message with severity <a href="#LOG_CRIT">LOG_CRIT</a>, ignoring the severity passed to New. </p>
+<h3 id="Writer.Debug">func (*Writer) <span>Debug</span> </h3> <pre data-language="go">func (w *Writer) Debug(m string) error</pre> <p>Debug logs a message with severity <a href="#LOG_DEBUG">LOG_DEBUG</a>, ignoring the severity passed to New. </p>
+<h3 id="Writer.Emerg">func (*Writer) <span>Emerg</span> </h3> <pre data-language="go">func (w *Writer) Emerg(m string) error</pre> <p>Emerg logs a message with severity <a href="#LOG_EMERG">LOG_EMERG</a>, ignoring the severity passed to New. </p>
+<h3 id="Writer.Err">func (*Writer) <span>Err</span> </h3> <pre data-language="go">func (w *Writer) Err(m string) error</pre> <p>Err logs a message with severity <a href="#LOG_ERR">LOG_ERR</a>, ignoring the severity passed to New. </p>
+<h3 id="Writer.Info">func (*Writer) <span>Info</span> </h3> <pre data-language="go">func (w *Writer) Info(m string) error</pre> <p>Info logs a message with severity <a href="#LOG_INFO">LOG_INFO</a>, ignoring the severity passed to New. </p>
+<h3 id="Writer.Notice">func (*Writer) <span>Notice</span> </h3> <pre data-language="go">func (w *Writer) Notice(m string) error</pre> <p>Notice logs a message with severity <a href="#LOG_NOTICE">LOG_NOTICE</a>, ignoring the severity passed to New. </p>
+<h3 id="Writer.Warning">func (*Writer) <span>Warning</span> </h3> <pre data-language="go">func (w *Writer) Warning(m string) error</pre> <p>Warning logs a message with severity <a href="#LOG_WARNING">LOG_WARNING</a>, ignoring the severity passed to New. </p>
+<h3 id="Writer.Write">func (*Writer) <span>Write</span> </h3> <pre data-language="go">func (w *Writer) Write(b []byte) (int, error)</pre> <p>Write sends a log message to the syslog daemon. </p>
+<h2 id="pkg-note-BUG">Bugs</h2> <ul> <li>☞ <p>This package is not implemented on Windows. As the syslog package is frozen, Windows users are encouraged to use a package outside of the standard library. For background, see <a href="https://golang.org/issue/1108">https://golang.org/issue/1108</a>. </p>
+</li> <li>☞ <p>This package is not implemented on Plan 9. </p>
+</li> </ul><div class="_attribution">
+ <p class="_attribution-p">
+ &copy; Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br>
+ <a href="http://golang.org/pkg/log/syslog/" class="_attribution-link">http://golang.org/pkg/log/syslog/</a>
+ </p>
+</div>