logSentry[source]

logSentry(message:str, data:typing.Any={}, level:str='info', section:str='main')

just add docs for ease of logging to sentry Input: message ::str:: required :: message to send to sentry data ::dict:: optional :: and object to send to sentry (default is an empty dict) level ::str::optional:: log level (default:info) section ::str::optional:: section name or function name (default: main) Response: Bool:: true means logged properly, false for error, print error message to console

logSentry('hello', {'hello':'this is a test'}, level='error', section = 'test')
capture_message('testing')
'3b6d224dc8f04b27882f84e09e062ad1'

full example

from nicHelper.sentryUtil import logSentry
logSentry('this is a test', {'testobject': 'testvalue'})
True

autologging to sentry

require sentry_sdk

autologSentry[source]

autologSentry(originalFunction=None, verbose=False)

@autologSentry(verbose=True)
def testFunction(input_):
  '''this is crazy'''
  return input_ + '1'

testFunction('123')
testFunction testFunction(input_) {'args': ('123',), 'kwargs': {}, 'output': '1231'}
'1231'
help(testFunction)
Help on function testFunction in module __main__:

testFunction(input_)
    this is crazy

from dataclasses import dataclass
@dataclass
class TestClass:
    @autologSentry
    def test(self, input_):
        return input_
TestClass().test('test')
'test'
help(TestClass.test)
Help on function test in module __main__:

test(self, input_)