You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The unix openlog() function call takes a parameter option:
void openlog(const char *ident, int option, int facility);
On of these controls whether or not PID of the process is included in the generated logpoint.
The bit from sys/syslog.h the controls this is:
define LOG_PID 0x01 /* log the pid with each message */
This may also be controlled from the command line logger utility using the command line option:
-i Log the process id of the logger process with each line.
This issue discusses extending the existing syslog package to allow this to be control.
The existing Go package includes the PID by default and doesn't offer a way to control it, this change would preserve the existing default and add two new methods
func (w *Writer) UnsetOptions(opt int)
To remove options and the other one:
func (w *Writer) SetOptions(opt int)
To add option bits.
Only one option bit would be added:
const (
// The syslog options, only OPT_PID is supported
LOG_PID = 0x1
)
The text was updated successfully, but these errors were encountered:
ianlancetaylor
changed the title
Add the ability to suppress the [<pid>] part of a syslog point
log/syslog: Add the ability to suppress the [<pid>] part of a syslog point
Oct 7, 2015
I would vote no. I think we all regret adding the log/syslog package to the standard library. Adding more API surface just gives us more to maintain. It's a small package; if you want different behavior, copy it into your source tree.
The unix openlog() function call takes a parameter option:
void openlog(const char *ident, int option, int facility);
On of these controls whether or not PID of the process is included in the generated logpoint.
The bit from sys/syslog.h the controls this is:
define LOG_PID 0x01 /* log the pid with each message */
This may also be controlled from the command line logger utility using the command line option:
This issue discusses extending the existing syslog package to allow this to be control.
The existing Go package includes the PID by default and doesn't offer a way to control it, this change would preserve the existing default and add two new methods
func (w *Writer) UnsetOptions(opt int)
To remove options and the other one:
func (w *Writer) SetOptions(opt int)
To add option bits.
Only one option bit would be added:
const (
// The syslog options, only OPT_PID is supported
)
The text was updated successfully, but these errors were encountered: