(args: SysLogArgs, vm: &VirtualMachine)
| 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() { |
nothing calls this directly
no test coverage detected