Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add syslog APIs #413

Closed
lambda-fairy opened this issue Sep 2, 2016 · 8 comments · Fixed by #2537
Closed

Add syslog APIs #413

lambda-fairy opened this issue Sep 2, 2016 · 8 comments · Fixed by #2537

Comments

@lambda-fairy
Copy link

The syslog interfaces are useful for writing daemons and such. It would be nice to have bindings to them.

@lambda-fairy
Copy link
Author

lambda-fairy commented Sep 2, 2016

I've published a preliminary set of bindings on my fork. There are a few issues with it so far:

  • According to the Linux documentation, the ident argument to openlog() should have a static lifetime. I have modeled this using &'static CStr, which is correct but kind of fiddly.
  • The interface of syslog() itself almost matches that of printf, except the former supports an extra code %m. I have no idea how to expose this safely. EDIT: printf supports this code as well.

Given these issues, I think we'd be better off just using a pure-Rust implementation instead.

@fiveop
Copy link
Contributor

fiveop commented Sep 2, 2016

I have modeled this using &'static CStr, which is correct but kind of fiddly.

I think is the correct way to expose it safely.

The interface of syslog() itself almost matches that of printf, except the former supports an extra code %m. I have no idea how to expose this safely.

I have not encountered a good way of dealing with foreign functions with a variable number of arguments. When strings are involved, it only gets messier.

@lambda-fairy
Copy link
Author

I have not encountered a good way of dealing with foreign functions with a variable number of arguments. When strings are involved, it only gets messier.

A syntax extension would work, but I think that would be overkill for this crate.

@tisonkun
Copy link
Contributor

I think we'd be better off just using a pure-Rust implementation instead.

A binding is still helpful.

Today, I tried to write syslogs to macos, and encounter this issue python/cpython#91070, while directly call syslog(3) can work.

@tisonkun
Copy link
Contributor

Or from the other perspective, how to implement syslog lib as in rust?

I made https://github.com/fast/fasyslog/ as a syslog client library. It works well for remote server and if the syslog daemon listens to a UNIX domain socket. But macos no longer works in either way so it's hard to make it work on macos.

@SteveLauC
Copy link
Member

A binding is still helpful.

while directly call syslog(3) can work.

Considering that macOS bug, I agree it would be still helpful to bind them, if we can safely do so.

@SteveLauC SteveLauC reopened this Nov 12, 2024
@tisonkun
Copy link
Contributor

The interface of syslog() itself almost matches that of printf, except the former supports an extra code %m. I have no idea how to expose this safely. EDIT: printf supports this code as well.

I don't think we need to support the C formatter. Rust has its own format functions and we can also pass the formatted string without any other format signs.

@SteveLauC SteveLauC linked a pull request Nov 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants