40 lines
791 B
Crystal
40 lines
791 B
Crystal
# 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>
|
|
|
|
require "yaml"
|
|
require "colorize"
|
|
require "json"
|
|
require "log"
|
|
|
|
require "./filesystems/gocryptfs"
|
|
require "./config"
|
|
require "./cli"
|
|
|
|
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
|
|
|
|
|
|
app = GX::Cli.new
|
|
app.parse_command_line(ARGV)
|
|
app.run
|
|
|
|
|