From: Tobias Ulmer Date: Mon, 8 Sep 2014 13:31:46 +0000 (+0200) Subject: e2lib.log(): make newline optional X-Git-Tag: e2factory-2.3.15rc1~191 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=e49b10c3b0017d964e995b6a468c5b1002a1ac16;p=e2factory.git e2lib.log(): make newline optional Signed-off-by: Tobias Ulmer --- diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 7e51d20..414c193 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -567,7 +567,8 @@ end -- is true -- @param level number: loglevel -- @param msg string: log message -function e2lib.log(level, msg) +-- @param nonewline Defaults to false. Do not append newline if set to true. +function e2lib.log(level, msg, nonewline) if level < 1 or level > 4 then e2lib.log(1, "Internal error: invalid log level") end @@ -578,7 +579,7 @@ function e2lib.log(level, msg) local log_prefix = "[" .. level .. "] " - if string.sub(msg, -1) ~= "\n" then + if not nonewline and string.sub(msg, -1) ~= "\n" then msg = msg.."\n" end