Skip to content

Commit

Permalink
Merge pull request #18 from jsuchome/master
Browse files Browse the repository at this point in the history
API for logger, needed for bug 785551
  • Loading branch information
jsuchome committed Oct 22, 2012
2 parents 1939f23 + 3cde402 commit afa5afe
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.23.6
2.23.7
44 changes: 44 additions & 0 deletions library/modules/Syslog.ycp
@@ -0,0 +1,44 @@
/**
* File: modules/Syslog.ycp
* Package: yast2
* Summary: Access to system log
*
* Usage:
* Syslog::ComplexLog ("", ["-i", "-f", "/tmp/logmessage"]);
* Syslog::Log ("user was created");
*/

{

module "Syslog";

import "String";

/**
* Write a message into system log
* @param log message
* @param logger options - see man logger for a list
* @return result off logger call
*/
global boolean ComplexLog (string message, list<string> options) {

options = maplist (string o, options, {
return sformat ("'%1'", String::Quote (o));
});

return 0 == SCR::Execute (.target.bash, sformat ("/bin/logger %1 -- %2",
mergestring (options, " "),
message == "" ? "" : ("'" + String::Quote (message) + "'"))
);
}

/**
* Write a message into system log
* @param log message
* @return result off logger call
*/
global boolean Log (string message) {

return ComplexLog (message, []);
}
}
6 changes: 6 additions & 0 deletions package/yast2.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Oct 19 11:36:26 CEST 2012 - jsuchome@suse.cz

- added Syslog module, simple API to write into system log
- 2.23.7

-------------------------------------------------------------------
Thu Oct 11 14:49:04 CEST 2012 - jsuchome@suse.cz

Expand Down

0 comments on commit afa5afe

Please sign in to comment.