Skip to content

Commit

Permalink
replace some prints by utils.log
Browse files Browse the repository at this point in the history
utils.log is prefered because we can control its output for example
disabling writing to stdout when testing.
  • Loading branch information
spiccinini committed Oct 11, 2019
1 parent 485cf11 commit d81c12c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function openwrt_wan.detect_hardware()
config.set(openwrt_wan.sectionName, "linux_name", ifname)
config.end_batch()
else
print("No wan interface detected")
utils.log("No wan interface detected")
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function babeld.configure(args)
if babeld.configured then return end
babeld.configured = true

print("lime.proto.babeld.configure(...)")
utils.log("lime.proto.babeld.configure(...)")

fs.writefile("/etc/config/babeld", "")

Expand Down Expand Up @@ -93,11 +93,11 @@ end

function babeld.setup_interface(ifname, args)
if not args["specific"] and ifname:match("^wlan%d+.ap") then
print("lime.proto.babeld.setup_interface(...)", ifname, "ignored")
utils.log("lime.proto.babeld.setup_interface(...)", ifname, "ignored")
return
end

print("lime.proto.babeld.setup_interface(...)", ifname)
utils.log("lime.proto.babeld.setup_interface(...)", ifname)

local vlanId = args[2] or 17
local vlanProto = args[3] or "8021ad"
Expand Down
12 changes: 6 additions & 6 deletions packages/lime-system/files/usr/lib/lua/lime/network.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function network.primary_address(offset)
if invalid then
ipv4_template = mc:maxhost()
ipv4_template:prefix(tonumber(ipv4_maskbits))
print("INVALID main_ipv4_address " ..tostring(mc).. " IDENTICAL TO RESERVED "
utils.log("INVALID main_ipv4_address " ..tostring(mc).. " IDENTICAL TO RESERVED "
..invalid.. " ADDRESS. USING " ..tostring(ipv4_template))
end

Expand Down Expand Up @@ -143,7 +143,7 @@ function network.setup_dns()
end

function network.clean()
print("Clearing network config...")
utils.log("Clearing network config...")

local uci = config.get_uci_cursor()

Expand All @@ -167,20 +167,20 @@ function network.clean()
uci:save("network")

if config.get_bool("network", "use_odhcpd", false) then
print("Use odhcpd as dhcp server")
utils.log("Use odhcpd as dhcp server")
uci:set("dhcp", "odchpd", "maindhcp", 1)
os.execute("/etc/init.d/odhcpd enable")
else
print("Disabling odhcpd")
utils.log("Disabling odhcpd")
uci:set("dhcp", "odchpd", "maindhcp", 0)
os.execute("/etc/init.d/odhcpd disable")
end

print("Cleaning dnsmasq")
utils.log("Cleaning dnsmasq")
uci:foreach("dhcp", "dnsmasq", function(s) uci:delete("dhcp", s[".name"], "server") end)
uci:save("dhcp")

print("Disabling 6relayd...")
utils.log("Disabling 6relayd...")
fs.writefile("/etc/config/6relayd", "")
end

Expand Down
4 changes: 2 additions & 2 deletions packages/lime-system/files/usr/lib/lua/lime/system.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ function system.clean()
end

function system.configure()
print("Configuring system...")
utils.log("Configuring system...")
system.set_hostname()

print("Let uhttpd listen on IPv4/IPv6")
utils.log("Let uhttpd listen on IPv4/IPv6")
local uci = config.get_uci_cursor()
uci:set("uhttpd", "main", "listen_http", "80")
uci:set("uhttpd", "main", "listen_https", "443")
Expand Down
2 changes: 1 addition & 1 deletion packages/lime-system/files/usr/lib/lua/lime/wireless.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function wireless.get_phy_mac(phy)
end

function wireless.clean()
print("Clearing wireless config...")
utils.log("Clearing wireless config...")
local uci = config.get_uci_cursor()
uci:foreach("wireless", "wifi-iface", function(s) uci:delete("wireless", s[".name"]) end)
uci:save("wireless")
Expand Down

0 comments on commit d81c12c

Please sign in to comment.