forked from NVIDIA/cub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Some logging + fix for variant builds
- Loading branch information
1 parent
8f92f51
commit 451f2f6
Showing
3 changed files
with
49 additions
and
9 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
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
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import logging | ||
|
||
class Logger: | ||
_instance = None | ||
|
||
def __new__(cls, *args, **kwargs): | ||
if cls._instance is None: | ||
cls._instance = super().__new__(cls, *args, **kwargs) | ||
logger = logging.getLogger() | ||
logger.setLevel(logging.DEBUG) | ||
file_handler = logging.FileHandler('cub_bench_meta.log') | ||
file_handler.setFormatter(logging.Formatter('%(asctime)s: %(message)s')) | ||
logger.addHandler(file_handler) | ||
cls._instance.logger = logger | ||
|
||
return cls._instance | ||
|
||
def info(self, message): | ||
self.logger.info(message) |