Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from jsuchome/master
API for logger, needed for bug 785551
- Loading branch information
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.23.6 | ||
2.23.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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, []); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters