-
-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import pyrevit.coreutils mutes my logger #575
Comments
Give me a little more info on what you are trying to do. The startup log message is controlled through Settings tool. I'm not sure why you are manually reaching inside the API to close the windows with I'm thinking the issue is that you want everything in pyrevit to be silent ("No Reporting" under settings) but the info messages from your tool to be printed still? |
pyRevit shared the same logging module with all the scripts and sets it up extensively in import os.path as op
import logging
#pylint: disable=import-error,invalid-name,broad-except
from pyrevit import USER_SYS_TEMP
from pyrevit import coreutils
from pyrevit import script
slogger = script.get_logger()
# create own logger
LOG_REC_FORMAT_FILE = "%(asctime)s %(levelname)s: [%(name)s] %(message)s"
LOG_FILEPATH = op.join(USER_SYS_TEMP, 'indeplog.log')
file_hndlr = logging.FileHandler(LOG_FILEPATH, mode='a')
file_formatter = logging.Formatter(LOG_REC_FORMAT_FILE)
file_hndlr.setFormatter(file_formatter)
logger = logging.getLogger('MyIndependentLogger') # type: LoggerWrapper
logger.addHandler(file_hndlr)
slogger.info('logget type: %s', type(slogger))
slogger.critical('testing CRITICAL')
slogger.error('testing ERROR')
slogger.warning('testing WARNING')
slogger.info('testing INFO')
slogger.debug('testing DEBUG')
logger.info('logget type: %s', type(logger))
logger.critical('testing CRITICAL')
logger.error('testing ERROR')
logger.warning('testing WARNING')
logger.info('testing INFO')
logger.debug('testing DEBUG')
coreutils.show_entry_in_explorer(LOG_FILEPATH)
del logger Tested this on v4.6.24 dev branch and works. The independent script |
Hello Ehsan,
I have a pushbutton from which I log activity with
I wanted not to display the terminal window that pops out at execution. So I did this
Despite this line does the trick,
import pyrevit.coreutils ...
somehow diverts my logs, and nothing is written to the file. Do you know how I can not display the cmd window without muting my logs?Thank you
FYI but not necessary, the fileConfig contains this. Logs are also muted if I decide to use the root logger with
logger = logging.getLogger()
or if I choose my own screen logginglogger = logging.getLogger("angeloscreen")
or if I use thestderr
instead ofstdout
.The text was updated successfully, but these errors were encountered: