MCPcopy Index your code
hub / github.com/RustPython/RustPython / syslog

Function syslog

crates/stdlib/src/syslog.rs:108–121  ·  view source on GitHub ↗
(args: SysLogArgs, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

106
107 #[pyfunction]
108 fn syslog(args: SysLogArgs, vm: &VirtualMachine) -> PyResult<()> {
109 let (priority, msg) = match args.message_object.flatten() {
110 Some(s) => (args.priority.try_into_value(vm)?, s),
111 None => (LOG_INFO, args.priority.try_into_value(vm)?),
112 };
113
114 if global_ident().read().is_none() {
115 openlog(OpenLogArgs::default(), vm)?;
116 }
117
118 let (cformat, cmsg) = ("%s".to_cstring(vm)?, msg.to_cstring(vm)?);
119 unsafe { libc::syslog(priority, cformat.as_ptr(), cmsg.as_ptr()) };
120 Ok(())
121 }
122
123 #[pyfunction]
124 fn closelog() {

Callers

nothing calls this directly

Calls 8

global_identFunction · 0.85
openlogFunction · 0.85
try_into_valueMethod · 0.80
flattenMethod · 0.45
is_noneMethod · 0.45
readMethod · 0.45
to_cstringMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected