2626
2727
2828# Read environment variables once at module load time
29- _API_LOG_LEVEL = int (os .environ .get ("FLASHINFER_APILOG_LEVEL " , "0" ))
30- _API_LOG_DEST = os .environ .get ("FLASHINFER_APILOG_DEST " , "./flashinfer_log.txt " )
29+ _API_LOG_LEVEL = int (os .environ .get ("FLASHINFER_LOGLEVEL_DBG " , "0" ))
30+ _API_LOG_DEST = os .environ .get ("FLASHINFER_LOGDEST_DBG " , "stdout " )
3131
3232# Create logger using Python's logging library
3333_logger = logging .getLogger ("flashinfer.api" )
@@ -41,7 +41,7 @@ def _setup_logger():
4141 _logger .setLevel (logging .CRITICAL + 1 ) # Higher than any level
4242 return
4343
44- # All enabled levels use loggging.DEBUG; verbosity is controlled by FLASHINFER_APILOG_LEVEL instead
44+ # All enabled levels use loggging.DEBUG; verbosity is controlled by FLASHINFER_LOGLEVEL_DBG instead
4545 _logger .setLevel (logging .DEBUG )
4646
4747 # Remove any existing handlers
@@ -446,17 +446,17 @@ def flashinfer_api_log(func: Callable = None) -> Callable:
446446 Decorator to log FlashInfer API calls using Python's logging library.
447447
448448 This decorator integrates with Python's standard logging infrastructure while
449- maintaining zero overhead when disabled (FLASHINFER_APILOG_LEVEL =0).
449+ maintaining zero overhead when disabled (FLASHINFER_LOGLEVEL_DBG =0).
450450
451451 Environment Variables
452452 ---------------------
453- FLASHINFER_APILOG_LEVEL : int (default: 0)
453+ FLASHINFER_LOGLEVEL_DBG : int (default: 0)
454454 - 0: No logging (zero overhead - decorator returns original function)
455455 - 1: Log function name only (logged BEFORE execution - crash-safe)
456456 - 2: Log function name + inputs/outputs with metadata (inputs logged BEFORE execution - crash-safe)
457457 - 3: Log function name + inputs/outputs with metadata + tensor statistics (inputs logged BEFORE execution - crash-safe)
458458
459- FLASHINFER_APILOG_DEST : str (default: "./flashinfer_log.txt ")
459+ FLASHINFER_LOGDEST_DBG : str (default: "stdout ")
460460 - "stdout": Log to standard output
461461 - "stderr": Log to standard error
462462 - <path>: Log to specified file path
@@ -471,7 +471,7 @@ def flashinfer_api_log(func: Callable = None) -> Callable:
471471
472472 Notes
473473 -----
474- - When FLASHINFER_APILOG_LEVEL =0, the decorator has truly zero overhead
474+ - When FLASHINFER_LOGLEVEL_DBG =0, the decorator has truly zero overhead
475475 as it returns the original function unchanged.
476476 - Function names and inputs are logged BEFORE execution:
477477 - Level 1: Function name only
0 commit comments