mirror of
https://github.com/glimpse-app/server.git
synced 2025-04-02 10:52:45 -04:00
logging boilerplate
This commit is contained in:
parent
8f43a434bd
commit
b9969e9596
1 changed files with 29 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
import std/[strutils, os, json, asyncdispatch, httpclient, with]
|
||||
import std/[strutils, os, json, asyncdispatch, httpclient, with, logging]
|
||||
|
||||
import jester
|
||||
import checksums/sha3
|
||||
|
@ -9,6 +9,34 @@ import ./[database, helpers]
|
|||
import ./types/[users, files]
|
||||
import ./routes/[auth, delete, download, upload, update]
|
||||
|
||||
const logo = """
|
||||
|
||||
█████████ ████ ███
|
||||
███░░░░░███░░███ ░░░
|
||||
███ ░░░ ░███ ████ █████████████ ████████ █████ ██████
|
||||
░███ ░███ ░░███ ░░███░░███░░███ ░░███░░███ ███░░ ███░░███
|
||||
░███ █████ ░███ ░███ ░███ ░███ ░███ ░███ ░███░░█████ ░███████
|
||||
░░███ ░░███ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ░░░░███░███░░░
|
||||
░░█████████ █████ █████ █████░███ █████ ░███████ ██████ ░░██████
|
||||
░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░ ░░░░░ ░███░░░ ░░░░░░ ░░░░░░
|
||||
░███
|
||||
█████
|
||||
░░░░░
|
||||
"""
|
||||
|
||||
const logFormattingString = "[$date $time] - [$levelname]: "
|
||||
|
||||
if cfg.enableLogs:
|
||||
addHandler newConsoleLogger(fmtStr = logFormattingString)
|
||||
addHandler newRollingFileLogger("glimpse-logs.log",
|
||||
fmtStr = logFormattingString)
|
||||
|
||||
if cfg.enableErrorLogs:
|
||||
addHandler newRollingFileLogger("glimpse-errors.log",
|
||||
fmtStr = logFormattingString, levelThreshold = lvlError)
|
||||
|
||||
log(lvlAll, logo)
|
||||
|
||||
settings:
|
||||
bindAddr = cfg.bindAddr
|
||||
port = Port(cfg.port)
|
||||
|
|
Loading…
Add table
Reference in a new issue