-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04cf993
commit c7c66d6
Showing
2 changed files
with
18 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,43 @@ | ||
(require-builtin steel/time) | ||
(require-builtin steel/strings/colors as colors.) | ||
|
||
(provide log! log/info! log/warn! log/debug! log/error!) | ||
(provide log! | ||
log/info! | ||
log/warn! | ||
log/debug! | ||
log/error!) | ||
|
||
(define *info* (colors.green "INFO")) | ||
(define *warn* (colors.yellow "WARN")) | ||
(define *debug* (colors.blue "DEBUG")) | ||
(define *error* (colors.red "ERROR")) | ||
(define *trace* (colors.purple "TRACE")) | ||
|
||
; (displayln "LOADING MODULE") | ||
|
||
; (define (log! level target arg-list) | ||
; (apply displayln (append | ||
; (list | ||
; (local-time/now! "%Y-%m-%dT%H:%M:%S") | ||
; " [" | ||
; level | ||
; " " | ||
; target | ||
; "] - ") | ||
; arg-list))) | ||
(define *info* "INFO") | ||
(define *warn* "WARN") | ||
(define *debug* "DEBUG") | ||
(define *error* "ERROR") | ||
(define *trace* "TRACE") | ||
|
||
;;@doc | ||
;; Log directly on the specified level the with arguments, as a list | ||
(define (log! level arg-list) | ||
(apply displayln (append | ||
(list | ||
(local-time/now! "%Y-%m-%dT%H:%M:%S") | ||
" [" | ||
level | ||
"] - ") | ||
arg-list))) | ||
(apply displayln (append (list (local-time/now! "%Y-%m-%dT%H:%M:%S") " [" level "] - ") arg-list))) | ||
|
||
;;@doc | ||
;; Log the arguments using the *info* target, i.e. log on INFO | ||
(define (log/info! . args) | ||
(log! *info* args)) | ||
(log! *info* args)) | ||
|
||
;;@doc | ||
;; Log the arguments using the *warn* target, i.e. log on WARN | ||
(define (log/warn! . args) | ||
(log! *warn* args)) | ||
(log! *warn* args)) | ||
|
||
;;@doc | ||
;; Log the arguments using the *debug* target, i.e. log on DEBUG | ||
(define (log/debug! . args) | ||
(log! *debug* args)) | ||
(log! *debug* args)) | ||
|
||
;;@doc | ||
;; Log the arguments using the *error* target, i.e. log on ERROR | ||
(define (log/error! . args) | ||
(log! *error* args)) | ||
(log! *error* args)) | ||
|
||
;;@doc | ||
;; Log the arguments using the *trace* target, i.e. log on TRACE | ||
(define (log/trace! . args) | ||
(log! *trace* args)) | ||
(log! *trace* args)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters