-
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.
- Loading branch information
Chsudeepta
authored and
Chsudeepta
committed
Oct 16, 2024
1 parent
6cae0a2
commit 9724796
Showing
2 changed files
with
21 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,24 @@ | ||
import os, sys | ||
|
||
import logging | ||
import sys | ||
|
||
from ibex_bluesky_core.logger import logger | ||
|
||
LOG_FOLDER = os.path.join("C:\\", "instrument", "var", "logs", "bluesky") | ||
LOG_MESSAGE = "Logging something to " | ||
LOG_ENV_PATH = "BLUESKY_LOGS" | ||
LOG_FILE_NAME = "blueskylogs.log" | ||
|
||
def test_GIVEN_logging_is_requested_THEN_handler_is_added(): | ||
this_function_name = sys._getframe( ).f_code.co_name | ||
message = LOG_MESSAGE + this_function_name | ||
# Log invocation. | ||
logger.blueskylogger.info(message); | ||
logger.blueskylogger.info(message) | ||
|
||
logHandler = None | ||
loghandler = None | ||
for handler in logger.blueskylogger.handlers: | ||
if isinstance(handler, logging.handlers.TimedRotatingFileHandler): | ||
logHandler = handler | ||
|
||
assert handler is not None | ||
assert handler.name == 'timedRotatingFileHandler' | ||
assert handler.when.lower() == 'midnight' | ||
assert handler.baseFilename.endswith(LOG_FILE_NAME) == True | ||
loghandler = handler | ||
|
||
|
||
assert loghandler is not None | ||
assert loghandler.name == 'timedRotatingFileHandler' | ||
assert loghandler.when.lower() == 'midnight' | ||
assert loghandler.baseFilename.endswith(LOG_FILE_NAME) |