30 0, LOG_DEBUG, LOG_INFO, LOG_NOTICE, LOG_WARNING, LOG_CRIT, LOG_EMERG, 0 };
32 prefix_ void senf::log::SyslogTarget::v_write(
time_type timestamp, std::string
const & stream,
33 std::string
const & area,
unsigned level,
34 std::string
const & message)
36 if (area !=
"senf::log::DefaultArea")
37 syslog(facility_ |
LEVELMAP[level],
"[%s] %s", area.c_str(), message.c_str());
39 syslog(facility_ |
LEVELMAP[level],
"%s", message.c_str());
52 prefix_ senf::log::SyslogTarget::RegisterConsole::RegisterConsole()
54 namespace kw = console::kw;
55 namespace fty = console::factory;
57 detail::TargetRegistry::instance().consoleDir()
58 .add(
"syslog-target",fty::Command(&RegisterConsole::create)
59 .arg(
"facility",
"syslog facility to send messages to. One of\n" 60 " AUTHPRIV CRON DAEMON FTP KERN LPR MAIL NEWS SYSLOG USER\n" 61 " UUCP LOCAL0 LOCAL1 LOCAL2 LOCAL3 LOCAL4 LOCAL5 LOCAL6 LOCAL7",
62 kw::default_value =
USER)
63 .doc(
"Create new syslog target. Examples:\n" 65 "Create new syslog target\n" 67 " <Directory '/sys/log/syslog'>\n" 69 "In a configuration file, create new syslog target and set some parameters (If\n" 70 "written on one line, this works at the console too:\n" 71 " /sys/log/syslog-target LOCAL2 {\n" 72 " route (IMPORTANT); # route all important messages\n" 73 " timeFormat \"\"; # use non-formatted time format\n" 74 " showArea false; # don't show log area\n" 78 prefix_ boost::shared_ptr<senf::console::DirectoryNode>
79 senf::log::SyslogTarget::RegisterConsole::create(
LogFacility facility)
82 Target & target (*tp.get());
83 detail::TargetRegistry::instance().dynamicTarget(std::move(tp));
84 return target.consoleDir().node().thisptr();
SyslogTarget(int facility=LOG_USER)
static int const LEVELMAP[8]
SyslogTarget public header.
SENF_CONSOLE_REGISTER_ENUM_MEMBER(SyslogTarget, LogFacility,(AUTHPRIV)(CRON)(DAEMON)(FTP)(KERN)(LPR)(MAIL)(NEWS)(SYSLOG)(USER)(UUCP)(LOCAL0)(LOCAL1)(LOCAL2)(LOCAL3)(LOCAL4)(LOCAL5)(LOCAL6)(LOCAL7))
config::time_type time_type
Target(std::string const &name)