mfm/src/main.cr

41 lines
791 B
Crystal
Raw Normal View History

2023-10-25 12:01:46 +00:00
# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 Glenn Y. Rolland <glenux@glenux.net>
# Copyright © 2023 Glenn Y. Rolland <glenux@glenux.net>
2023-10-20 09:29:54 +00:00
require "yaml"
require "colorize"
require "json"
require "log"
2023-10-20 09:29:54 +00:00
require "./filesystems/gocryptfs"
2023-10-22 21:23:56 +00:00
require "./config"
require "./cli"
2023-10-20 09:29:54 +00:00
struct BaseFormat < Log::StaticFormatter
def run
string @entry.severity.label.downcase
string "("
source
string "): "
message
end
end
Log.setup do |config|
backend = Log::IOBackend.new(formatter: BaseFormat)
config.bind "*", Log::Severity::Info, backend
if ENV["LOG_LEVEL"]?
level = Log::Severity.parse(ENV["LOG_LEVEL"]) || Log::Severity::Info
config.bind "*", level, backend
end
end
2023-10-22 21:23:56 +00:00
app = GX::Cli.new
app.parse_command_line(ARGV)
2023-10-22 21:23:56 +00:00
app.run
2023-10-20 09:29:54 +00:00