@@ -39,10 +39,8 @@ def _substitute_process_id(path: str) -> str:
3939
4040
4141# Read environment variables once at module load time
42- _API_LOG_LEVEL = int (os .environ .get ("FLASHINFER_LOGLEVEL_DBG" , "0" ))
43- _API_LOG_DEST = _substitute_process_id (
44- os .environ .get ("FLASHINFER_LOGDEST_DBG" , "stdout" )
45- )
42+ _API_LOG_LEVEL = int (os .environ .get ("FLASHINFER_APILEVEL" , "0" ))
43+ _API_LOG_DEST = _substitute_process_id (os .environ .get ("FLASHINFER_APIDEST" , "stdout" ))
4644
4745# Create logger using Python's logging library
4846_logger = logging .getLogger ("flashinfer.api" )
@@ -56,7 +54,7 @@ def _setup_logger():
5654 _logger .setLevel (logging .CRITICAL + 1 ) # Higher than any level
5755 return
5856
59- # All enabled levels use loggging.DEBUG; verbosity is controlled by FLASHINFER_LOGLEVEL_DBG instead
57+ # All enabled levels use loggging.DEBUG; verbosity is controlled by FLASHINFER_APILEVEL instead
6058 _logger .setLevel (logging .DEBUG )
6159
6260 # Remove any existing handlers
@@ -463,22 +461,22 @@ def _log_function_outputs(func_name: str, result: Any, level: int) -> None:
463461 _logger .debug ("\n " .join (lines ))
464462
465463
466- def flashinfer_log (func : Callable = None ) -> Callable :
464+ def flashinfer_api (func : Callable = None ) -> Callable :
467465 """
468466 Decorator to log FlashInfer API calls using Python's logging library.
469467
470468 This decorator integrates with Python's standard logging infrastructure while
471- maintaining zero overhead when disabled (FLASHINFER_LOGLEVEL_DBG =0).
469+ maintaining zero overhead when disabled (FLASHINFER_APILEVEL =0).
472470
473471 Environment Variables
474472 ---------------------
475- FLASHINFER_LOGLEVEL_DBG : int (default: 0)
473+ FLASHINFER_APILEVEL : int (default: 0)
476474 - 0: No logging (zero overhead - decorator returns original function)
477475 - 1: Log function name only (logged BEFORE execution - crash-safe)
478476 - 3: Log function name + inputs/outputs with metadata (inputs logged BEFORE execution - crash-safe)
479477 - 5: Log function name + inputs/outputs with metadata + tensor statistics (inputs logged BEFORE execution - crash-safe)
480478
481- FLASHINFER_LOGDEST_DBG : str (default: "stdout")
479+ FLASHINFER_APIDEST : str (default: "stdout")
482480 - "stdout": Log to standard output
483481 - "stderr": Log to standard error
484482 - <path>: Log to specified file path
@@ -488,15 +486,15 @@ def flashinfer_log(func: Callable = None) -> Callable:
488486 --------
489487 Basic usage:
490488
491- >>> @flashinfer_log
489+ >>> @flashinfer_api
492490 ... def my_function(x, y):
493491 ... return x + y
494492
495493 Notes
496494 -----
497495 - Key header lines include a timestamp in the format: [YYYY-MM-DD HH:MM:SS]
498496 (e.g., "FlashInfer API Call: function_name", "FlashInfer API Logging - System Information")
499- - When FLASHINFER_LOGLEVEL_DBG =0, the decorator has truly zero overhead
497+ - When FLASHINFER_APILEVEL =0, the decorator has truly zero overhead
500498 as it returns the original function unchanged.
501499 - Function names and inputs are logged BEFORE execution:
502500 - Level 1: Function name only
0 commit comments