From 2c6feb979da6435bb9f6636a46be576f688f7f78 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 9 Feb 2014 16:54:13 +0100 Subject: [log,*] s/log.names_report()/logs.report()/g Closing #169 Signed-off-by: Philipp Gesang --- luaotfload-auxiliary.lua | 2 +- luaotfload-database.lua | 2 +- luaotfload-diagnostics.lua | 4 +-- luaotfload-features.lua | 2 +- luaotfload-letterspace.lua | 10 +++--- luaotfload-log.lua | 16 ++++----- luaotfload-main.lua | 17 +++++----- luaotfload-override.lua | 8 ++--- luaotfload-parsers.lua | 2 +- luaotfload-tool.lua | 81 ++++++++++++++++++++++------------------------ 10 files changed, 70 insertions(+), 74 deletions(-) diff --git a/luaotfload-auxiliary.lua b/luaotfload-auxiliary.lua index 9ab78e7..716af98 100644 --- a/luaotfload-auxiliary.lua +++ b/luaotfload-auxiliary.lua @@ -17,7 +17,7 @@ luaotfload.aux = luaotfload.aux or { } local aux = luaotfload.aux local log = luaotfload.log -local report = log.names_report +local report = log.report local fonthashes = fonts.hashes local identifiers = fonthashes.identifiers diff --git a/luaotfload-database.lua b/luaotfload-database.lua index 8f603db..c69fc03 100644 --- a/luaotfload-database.lua +++ b/luaotfload-database.lua @@ -45,7 +45,7 @@ local stripslashes = parsers.stripslashes local splitcomma = parsers.splitcomma local log = luaotfload.log -local report = log.names_report +local report = log.report local report_status = log.names_status local report_status_start = log.names_status_start local report_status_stop = log.names_status_stop diff --git a/luaotfload-diagnostics.lua b/luaotfload-diagnostics.lua index 4ffaa06..67119de 100644 --- a/luaotfload-diagnostics.lua +++ b/luaotfload-diagnostics.lua @@ -49,9 +49,9 @@ local lpeg = require "lpeg" local C, Cg, Ct = lpeg.C, lpeg.Cg, lpeg.Ct local lpegmatch = lpeg.match -local names_report = luaotfload.log.names_report +local report = luaotfload.log.report local out = function (...) - names_report (false, 0, "diagnose", ...) + report (false, 0, "diagnose", ...) end local parsers = luaotfload.parsers diff --git a/luaotfload-features.lua b/luaotfload-features.lua index 73edcd2..4237d71 100644 --- a/luaotfload-features.lua +++ b/luaotfload-features.lua @@ -49,7 +49,7 @@ function fonts.definers.getspecification(str) end local log = luaotfload.log -local report = log.names_report +local report = log.report local stringfind = string.find local stringlower = string.lower diff --git a/luaotfload-letterspace.lua b/luaotfload-letterspace.lua index a855bf3..20f29f5 100644 --- a/luaotfload-letterspace.lua +++ b/luaotfload-letterspace.lua @@ -7,7 +7,7 @@ if not modules then modules = { } end modules ['letterspace'] = { } local log = luaotfload.log -local report = log.names_report +local report = log.report local getmetatable = getmetatable local require = require @@ -515,10 +515,10 @@ otffeatures.register { local initializecompatfontkerning = function (tfmdata, percentage) local factor = tonumber (percentage) if not factor then - names_report ("both", 0, "letterspace", - "Invalid argument to letterspace: %s (type %q), " .. - "was expecting percentage as Lua number instead.", - percentage, type (percentage)) + report ("both", 0, "letterspace", + "Invalid argument to letterspace: %s (type %q), " .. + "was expecting percentage as Lua number instead.", + percentage, type (percentage)) return end return initializefontkerning (tfmdata, factor * 0.01) diff --git a/luaotfload-log.lua b/luaotfload-log.lua index 080550a..5698c84 100644 --- a/luaotfload-log.lua +++ b/luaotfload-log.lua @@ -200,7 +200,7 @@ local level_ids = { common = 1, loading = 2, search = 3 } --[[doc-- - The names_report logger is used more or less all over luaotfload. + The report() logger is used more or less all over luaotfload. Its requirements are twofold: 1) Provide two logging channels, the terminal and the log file; @@ -224,7 +224,7 @@ local level_ids = { common = 1, loading = 2, search = 3 } --doc]]-- -local names_report = function (mode, lvl, ...) +local report = function (mode, lvl, ...) if type(lvl) == "string" then lvl = level_ids[lvl] end @@ -242,7 +242,7 @@ local names_report = function (mode, lvl, ...) end end -log.names_report = names_report +log.report = report --[[doc-- @@ -301,7 +301,7 @@ local status_start = function (low, high) or os.getenv "TERM" == "dumb" then status_writer = function (mode, ...) - names_report (mode, high, ...) + report (mode, high, ...) end return end @@ -310,7 +310,7 @@ local status_start = function (low, high) status_writer = status_logger else status_writer = function (mode, ...) - names_report (mode, high, ...) + report (mode, high, ...) end end end @@ -348,7 +348,7 @@ log.names_status_stop = status_stop --doc]]-- local texioreporter = function (message) - names_report("log", 2, message) + report ("log", 2, message) end texio.reporter = texioreporter @@ -386,10 +386,10 @@ if fonts then --- need to be running TeX if k == "unicodes" then local glyphlist = resolvers.findfile"luaotfload-glyphlist.lua" if glyphlist then - names_report("log", 1, "load", "loading the Adobe glyph list") + report ("log", 1, "load", "loading the Adobe glyph list") else glyphlist = resolvers.findfile"font-age.lua" - names_report("both", 0, "load", + report ("both", 0, "load", "loading the extended glyph list from ConTeXt") end local unicodes = dofile(glyphlist) diff --git a/luaotfload-main.lua b/luaotfload-main.lua index 35c01f2..f5f012d 100644 --- a/luaotfload-main.lua +++ b/luaotfload-main.lua @@ -148,7 +148,7 @@ end loadmodule "log.lua" --- messages; used to be part of -override local log = luaotfload.log -local report = log.names_report +local report = log.report log.set_loglevel(config.luaotfload.loglevel) @@ -387,7 +387,8 @@ end --- non-merge fallback scope pop_namespaces(our_environment, false)-- true) -report ("both", 0, "main", "fontloader loaded in %0.3f seconds", os.gettimeofday()-starttime) +report ("both", 0, "main", + "fontloader loaded in %0.3f seconds", os.gettimeofday()-starttime) --[[doc-- @@ -543,9 +544,9 @@ request_resolvers.anon = function (specification) local exists, _ = lfsisfile(name) if exists then --- garbage; we do this because we are nice, --- not because it is correct - log.names_report("log", 1, "load", "file %q exists", name) - log.names_report("log", 1, "load", - "... overriding borked anon: lookup with path: lookup") + report ("log", 1, "load", "file %q exists", name) + report ("log", 1, "load", + "... overriding borked anon: lookup with path: lookup") specification.name = name request_resolvers.path(specification) return @@ -567,9 +568,9 @@ request_resolvers.path = function (specification) local name = specification.name local exists, _ = lfsisfile(name) if not exists then -- resort to file: lookup - log.names_report("log", 1, "load", - "path lookup of %q unsuccessful, falling back to file:", - name) + report ("log", 1, "load", + "path lookup of %q unsuccessful, falling back to file:", + name) file_resolver (specification) else local suffix = filesuffix (name) diff --git a/luaotfload-override.lua b/luaotfload-override.lua index e726f6f..b75530b 100644 --- a/luaotfload-override.lua +++ b/luaotfload-override.lua @@ -10,7 +10,7 @@ local findfile = resolvers.findfile local encodings = fonts.encodings local log = luaotfload.log -local names_report = log.names_report +local report = log.report --[[doc-- @@ -38,11 +38,11 @@ setmetatable(fonts.encodings.agl, { __index = function (t, k) end local glyphlist = findfile "luaotfload-glyphlist.lua" if glyphlist then - names_report("log", 1, "load", "loading the Adobe glyph list") + report ("log", 1, "load", "loading the Adobe glyph list") else glyphlist = findfile "font-age.lua" - names_report("both", 0, "load", - "loading the extended glyph list from ConTeXt") + report ("both", 0, "load", + "loading the extended glyph list from ConTeXt") end local unicodes = dofile(glyphlist) encodings.agl = { unicodes = unicodes } diff --git a/luaotfload-parsers.lua b/luaotfload-parsers.lua index 8060d05..5145ca0 100644 --- a/luaotfload-parsers.lua +++ b/luaotfload-parsers.lua @@ -39,7 +39,7 @@ local io = io local ioopen = io.open local log = luaotfload.log -local report = log.names_report +local report = log.report local string = string local stringsub = string.sub diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index e791e3d..35765b5 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -154,7 +154,7 @@ luaotfloadconfig.status = luaotfloadstatus local sanitize_fontname = names.sanitize_fontname local log = luaotfload.log -local names_report = log.names_report -- TODO improve identifier +local report = log.report local pathdata = names.path local names_plain = pathdata.index.lua @@ -683,9 +683,9 @@ local show_font_info = function (basename, askedname, detail, warnings) if nfonts > 0 then -- true type collection local subfont if askedname then - log.names_report(true, 1, "resolve", - [[%s is part of the font collection %s]], - askedname, basename) + report (true, 1, "resolve", + [[%s is part of the font collection %s]], + askedname, basename) subfont = subfont_by_name(shortinfo, askedname) end if subfont then @@ -694,11 +694,11 @@ local show_font_info = function (basename, askedname, detail, warnings) show_full_info(fullname, subfont, warnings) end else -- list all subfonts - log.names_report(true, 1, "resolve", - [[%s is a font collection]], basename) + report (true, 1, "resolve", + [[%s is a font collection]], basename) for subfont = 1, nfonts do - log.names_report(true, 1, "resolve", - [[Showing info for font no. %d]], n) + report (true, 1, "resolve", + [[Showing info for font no. %d]], n) show_info_items(shortinfo[subfont]) if detail == true then show_full_info(fullname, subfont, warnings) @@ -712,8 +712,7 @@ local show_font_info = function (basename, askedname, detail, warnings) end end else - log.names_report(true, 1, "resolve", - "Font %s not found", filename) + report (true, 1, "resolve", "Font %s not found", filename) end end @@ -738,9 +737,8 @@ local actions = { } --- (jobspec -> (bool * bool)) list actions.loglevel = function (job) log.set_loglevel(job.log_level) - log.names_report("info", 3, "util", - "Setting log level", "%d", job.log_level) - log.names_report("log", 2, "util", "Lua=%s", _VERSION) + report ("info", 3, "util", "Setting log level", "%d", job.log_level) + report ("log", 2, "util", "Lua=%q", _VERSION) return true, true end @@ -766,8 +764,7 @@ end actions.generate = function (job) local fontnames, savedname fontnames = names.update(fontnames, job.force_reload, job.dry_run) - log.names_report("info", 2, "db", - "Fonts in the database: %i", #fontnames.mappings) + report ("info", 2, "db", "Fonts in the database: %i", #fontnames.mappings) if names.data() then return true, true end @@ -779,7 +776,7 @@ actions.flush = function (job) if success then local success = names.save_lookups() if success then - log.names_report("info", 2, "cache", "Lookup cache emptied") + report ("info", 2, "cache", "Lookup cache emptied") return true, true end end @@ -795,8 +792,8 @@ local cache_directives = { actions.cache = function (job) local directive = cache_directives[job.cache] if not directive or type(directive) ~= "function" then - log.names_report("info", 2, "cache", - "Invalid font cache directive %s.", job.cache) + report ("info", 2, "cache", + "Invalid font cache directive %s.", job.cache) return false, false end if directive() then @@ -840,28 +837,27 @@ actions.query = function (job) end if success then - log.names_report(false, 0, - "resolve", "Font %q found!", query) + report (false, 0, "resolve", "Font %q found!", query) if subfont then - log.names_report(false, 0, "resolve", - "Resolved file name %q, subfont nr. %q", + report (false, 0, "resolve", + "Resolved file name %q, subfont nr. %q", foundname, subfont) else - log.names_report(false, 0, "resolve", - "Resolved file name %q", foundname) + report (false, 0, "resolve", + "Resolved file name %q", foundname) end if job.show_info then show_font_info (foundname, query, job.full_info, job.warnings) iowrite "\n" end else - log.names_report(false, 0, - "resolve", "Cannot find %q in index.", query) - log.names_report(false, 0, - "resolve", "Hint: use the --fuzzy option to display suggestions.", query) + report (false, 0, "resolve", "Cannot find %q in index.", query) + report (false, 0, "resolve", + "Hint: use the --fuzzy option to display suggestions.", + query) if job.fuzzy == true then - log.names_report(false, 0, - "resolve", "Looking for close matches, this may take a while ...") + report (false, 0, "resolve", + "Looking for close matches, this may take a while ...") local _success = names.find_closest(query, job.fuzzy_limit) end end @@ -959,7 +955,7 @@ actions.list = function (job) local nmappings = #mappings if criterion == "*" then - log.names_report(false, 1, "list", "All %d entries", nmappings) + report (false, 1, "list", "All %d entries", nmappings) for i=1, nmappings do local entry = mappings[i] local fields = get_fields(entry, asked_fields) @@ -974,12 +970,12 @@ actions.list = function (job) criterion = criterion[1] asked_fields = set_primary_field(asked_fields, criterion) - log.names_report(false, 1, "list", "By %s", criterion) + report (false, 1, "list", "By %s", criterion) --- firstly, build a list of fonts to operate on local targets = { } if asked_value then --- only those whose value matches - log.names_report(false, 2, "list", "Restricting to value %s", asked_value) + report (false, 2, "list", "Restricting to value %s", asked_value) for i=1, nmappings do local entry = mappings[i] if entry[criterion] @@ -1024,7 +1020,7 @@ actions.list = function (job) end end local ntargets = #targets - log.names_report(false, 2, "list", "%d entries", ntargets) + report (false, 2, "list", "%d entries", ntargets) --- now, output the collection for i=1, ntargets do @@ -1232,24 +1228,23 @@ local main = function ( ) -- unit -> int local actionname = action_sequence[i] local exit = false if action_pending[actionname] then - log.names_report("log", 3, "util", "Preparing for task", - "%s", actionname) + report ("log", 3, "util", "Preparing for task", "%s", actionname) local action = actions[actionname] local success, continue = action(job) if not success then - log.names_report(false, 0, "util", - "Could not finish task", "%s", actionname) + report (false, 0, "util", + "Could not finish task", "%s", actionname) retval = -1 exit = true elseif not continue then - log.names_report(false, 3, "util", - "Task completed, exiting", "%s", actionname) - exit = true + report (false, 3, "util", + "Task completed, exiting", "%s", actionname) + exit = true else - log.names_report(false, 3, "util", - "Task completed successfully", "%s", actionname) + report (false, 3, "util", + "Task completed successfully", "%s", actionname) end end if exit then break end -- cgit v1.2.3