Skip to content

Commit

Permalink
Remove more log bloat
Browse files Browse the repository at this point in the history
  • Loading branch information
narc0tiq committed May 23, 2018
1 parent 06556b4 commit c1b53d5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.5
0.1.6
2 changes: 1 addition & 1 deletion control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ end)

for name, func in pairs(events) do
if not defines.events[name] then
log(string.format("test-mod: ignoring handler for non-existent event %s", name))
log(string.format("Ignoring handler for non-existent event %s", name))
else
script.on_event(defines.events[name], function(e)
local success, err = pcall(func, e)
Expand Down
20 changes: 10 additions & 10 deletions signals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ local function check_update_rate(sample_root)
end
end

log(string.format("Have %d faster update candidates, need %d to change.",
#faster_update_candidates, MAX_HISTORY_COUNT / 2 + 1))
-- log(string.format("Have %d faster update candidates, need %d to change.",
-- #faster_update_candidates, MAX_HISTORY_COUNT / 2 + 1))

-- showing _consistent_ change...
if #faster_update_candidates > MAX_HISTORY_COUNT / 2 + 1 then
Expand Down Expand Up @@ -185,7 +185,7 @@ local function calculate_rate_of_change(signal)

local update_rate = sample_root.update_rate or 300

log(string.format("Updating %s, signal %s, update rate %d ticks", signal.title, signal.signal.name, update_rate))
-- log(string.format("Updating %s, signal %s, update rate %d ticks", signal.title, signal.signal.name, update_rate))

local buckets = bucketize_samples(samples, update_rate)
if #buckets < 3 then
Expand All @@ -202,11 +202,11 @@ local function calculate_rate_of_change(signal)
local change_rate = change_per_min_between_samples(buckets[i], buckets[i + 1])
local weight = #buckets - i

log(string.format("Weight %d, difference %d, duration %d, unweighted change %f/min",
weight,
buckets[i].value - buckets[i+1].value,
buckets[i+1].tick - buckets[i].tick,
change_rate))
-- log(string.format("Weight %d, difference %d, duration %d, unweighted change %f/min",
-- weight,
-- buckets[i].value - buckets[i+1].value,
-- buckets[i+1].tick - buckets[i].tick,
-- change_rate))

sum_weighted_change_rates = sum_weighted_change_rates + weight * change_rate
sum_weights = sum_weights + weight
Expand All @@ -215,8 +215,8 @@ local function calculate_rate_of_change(signal)

local rate_of_change = sum_weighted_change_rates / sum_weights
sample_root.rate_of_change_per_min = rate_of_change
log(string.format("Final sum_weights: %d, sum_weighted_change_rates: %f. New change rate: %f/min",
sum_weights, sum_weighted_change_rates, rate_of_change))
-- log(string.format("Final sum_weights: %d, sum_weighted_change_rates: %f. New change rate: %f/min",
-- sum_weights, sum_weighted_change_rates, rate_of_change))

end

Expand Down

0 comments on commit c1b53d5

Please sign in to comment.