From e49b10c3b0017d964e995b6a468c5b1002a1ac16 Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Mon, 8 Sep 2014 15:31:46 +0200 Subject: [PATCH] e2lib.log(): make newline optional Signed-off-by: Tobias Ulmer --- generic/e2lib.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 -- 2.39.5