1
0
Fork 0
forked from glenux/mfm
mfm-demo/src/main.cr

41 lines
791 B
Crystal
Raw Normal View History

2023-10-25 14:01:46 +02: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 11:29:54 +02:00
require "yaml"
require "colorize"
require "json"
require "log"
2023-10-20 11:29:54 +02:00
require "./filesystems/gocryptfs"
2023-10-22 23:23:56 +02:00
require "./config"
require "./cli"
2023-10-20 11:29:54 +02: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 23:23:56 +02:00
app = GX::Cli.new
app.parse_command_line(ARGV)
2023-10-22 23:23:56 +02:00
app.run
2023-10-20 11:29:54 +02:00