Conversation
|
BTW, if my Prolog writing style does not follow whatever current writing style is being followed, please let me know. Or if my Prolog code needs idiomatic corrections. I am still a novice Prolog programmer. |
|
Fix for #116 |
|
Looks Good |
pisaev1
left a comment
There was a problem hiding this comment.
Although I think it should go to a separate repo.
There was a problem hiding this comment.
Although I think it should go to a separate repo.
There was a problem hiding this comment.
The fact that it potentially requires an installation step from the user
swipl pack install log4pmakes me want to agree. I suppose, only if this installation is handled automatically or added to build.sh or such, can it be part of the standard library, otherwise it is probably better hosted on its own repo.
I am neutral on this. So just provide some final confirmation and I will move it to its own repo.
There was a problem hiding this comment.
You can upload your library to a repository petta_lib_logger (name convention for PeTTa libs), the way it works: lib_logger.pl, lib_logger.metta and logger_example.metta are in the root of the repository. Then you can import your library with the log4p installation step included: !(git-import! "https://github.com/ngeiswei/petta_lib_logger" "swipl pack install log4p")
Last: please also add it to the registry page: https://github.com/trueagi-io/PeTTa/wiki/Extension-libraries
There was a problem hiding this comment.
I have moved it to its own repo, however it fails to pass the tests in logger_example.metta. Any idea?
There was a problem hiding this comment.
Thank you, @patham9. I've added petta_lib_logger to Extension-libraries, note that I took the freedom to reformat the page a bit (use markdown lists + added some more hyper-links). Let me know if you wish the formatting to be different.
29ad24e to
859f4bb
Compare
|
Closing as it has been moved to its own repo. |
Here is a complete, albeit slow, library for PeTTa to log timestamped messages into a file.
I qualify it as complete because it has everything that I need but of course more can always be added. It is slow, in particular logging a message actually opens the log file, writes the message, then closes it. So only use this logger for sufficiently infrequent logging tasks, for the time being anyway. This is of course intended to be fixed in the future.
A couple of remarks:
swipl pack install log4pto install log4p. It is unclear to me how to install this automatically. Maybe the build script of PeTTa could take care of it. I am not sure.logger-. Examples of method names arelogger-filepath,logger-info, etc. Another naming convention could be to prefix method names withLogger.which would create method namesLogger.filepath,Logger.info, etc. Or maybe the Prolog way,logger:filepath,logger:info, etc. I don't know which way we should go for, so please let me know if you do.