cl-grep

Simple implementation of grep
Log | Files | Refs

commit 8ffa6e1beb0863443b0376e2bb805bb7190b7ac1
parent 0557e2241c72507941eff165a1a76ea0c1ab4445
Author: ChanderG <[email protected]>
Date:   Mon,  8 Dec 2025 19:09:16 +0530

add compile time logging feature selection

Diffstat:
MMakefile | 2+-
Mgrep.asd | 9++++++++-
Mlog.lisp | 12+++++++++++-
3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -5,4 +5,4 @@ build: --eval '(quit)' clean: - rm cl-grep + rm cl-grep cl-grep.log *.fasl diff --git a/grep.asd b/grep.asd @@ -1,3 +1,10 @@ +;; these new features only work when defined here in this file +;; putting into a separate file and loading into sbcl in the makefile +;; does not work + +;; comment this to disable logging at compile time +(pushnew :logging *features*) + (asdf:defsystem grep :version "0.0.1" :author "Chander Govindarajan" @@ -10,7 +17,7 @@ :depends-on (:uiop :filesystem-utils :pathname-utils - :vom + (:feature :logging :vom) :lparallel :bordeaux-threads :cl-string-match diff --git a/log.lisp b/log.lisp @@ -1,10 +1,20 @@ (in-package :cl-grep) +;; Make implementation gated behind feature flag + +#+logging (defun log-setup () (vom:config t :info) (setf vom:*log-stream* (open "./cl-grep.log" :direction :output :if-exists :overwrite :if-does-not-exist :create))) +#-logging +(defun log-setup () + nil) (defmacro lo (&rest args) - `(vom:info ,@args)) + #+logging + `(vom:info ,@args) + #-logging + nil) +