-
Notifications
You must be signed in to change notification settings - Fork 33
Migrate from Lwt_log to Logs #256
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
Conversation
src/files/ocsigenserver.conf/gen.ml
Outdated
; "ocsigenserver" ] | ||
in | ||
let packages = | ||
"lwt_ssl,bytes,lwt.unix,logs,logs-syslog,syslog-message,ipaddr,findlib,cryptokit,re,str,xml-light,dynlink,cohttp-lwt-unix,hmap" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be updated as follows:
"lwt_ssl,bytes,lwt.unix,logs,logs-syslog,syslog-message,ipaddr,findlib,cryptokit,re,str,xml-light,dynlink,cohttp-lwt-unix,hmap" | |
"lwt_ssl,bytes,lwt.unix,logs,logs-syslog.unix,syslog-message,ipaddr,findlib,cryptokit,re,str,xml-light,dynlink,cohttp-lwt-unix" |
I suspect the computation of the dependencies fail silently when hmap
is not installed. This is why ocsigenserver
tries (unsuccessfully) to load unix.cma
. One should check the return value of Unix.close_process_in inp
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a failure case when this happens so it should now be noticed. Thanks for the debugging !
This replaces all uses of the Lwt_log library by Logs. Lwt_log is deprecated and its README suggest to use Logs instead so it seems like a good choice. The bulk of the change was done with the lwt-log-to-logs tool. This is almost a 1 to 1 translation as the two libraries are very similar but there are some differences: - The "Fatal" log level doesn't exist in Logs. "Error" is used instead. - Log messages are formatted with Format. - Logs has no equivalent of "broadcast" and "dispatch" available out of the box. These operations are easily supported by generating more code. - There is no equivalent for Lwt_log.add_rule in Logs. Luckily it can be avoided in this project. This might cause more work in Ocsigen applications that use their own log sections. - Syslog support is done by the "logs-syslog" library. - There is no equivalent for Lwt_log.close. Ocsigen_messages is still able to close its reporters, except for the syslog reporter, which doesn't support this operation.
This restores Ocsigen's message format, including the date and section name. This adds the log level to the message, which was missing before.
Co-authored-by: Jérôme Vouillon <[email protected]>
This caused the config to be generated with the wrong dependency list, which caused errors while loading server plugins at runtime.
I think we can merge both if you fix the build and resolve the conflict of ocsigen/eliom#822. |
The comments are not replaced as any generic comment would be less useful than the signature itself.
Thanks for reviewing :) I think it's all fixed now. |
Based on top of these other PRs,
The Eliom side work is,
This replaces all uses of the Lwt_log library by Logs. Lwt_log is
deprecated and its README suggest to use Logs instead so it seems like a
good choice.
The bulk of the change was done with the lwt-log-to-logs tool: Julow/lwt-to-direct-style#5
This is almost a 1 to 1 translation as the two libraries are very
similar but there are some differences:
The "Fatal" log level doesn't exist in Logs. "Error" is used instead.
Log messages are formatted with Format.
Logs has no equivalent of "broadcast" and "dispatch" available out of
the box. These operations are easily supported by generating more
code.
There is no equivalent for Lwt_log.add_rule in Logs. Luckily it can be
avoided in this project. This might cause more work in Ocsigen
applications that use their own log sections.
Syslog support is done by the "logs-syslog" library.
There is no equivalent for Lwt_log.close. Ocsigen_messages is still
able to close its reporters, except for the syslog reporter, which
doesn't support this operation.