Skip to content

Commit

Permalink
instagram: fix logger
Browse files Browse the repository at this point in the history
  • Loading branch information
naisanzaa committed Oct 25, 2023
1 parent 18a98bf commit 55bbf68
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
5 changes: 3 additions & 2 deletions automon/integrations/instagram/client.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from automon import Logging
from automon.log import logger

from .config import InstagramConfig

log = Logging('InstagramClient', level=Logging.INFO)
log = logger.logging.getLogger(__name__)
log.setLevel(logger.INFO)


class InstagramClient(object):
Expand Down
7 changes: 4 additions & 3 deletions automon/integrations/instagram/client_browser.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import functools

from automon import Logging
from automon.log import logger
from automon.integrations.seleniumWrapper.browser import SeleniumBrowser

from automon.helpers.sleeper import Sleeper
Expand All @@ -10,7 +10,8 @@
from .urls import Urls
from .xpaths import XPaths

log = Logging('InstagramClientBrowser', level=Logging.INFO)
log = logger.logging.getLogger(__name__)
log.setLevel(logger.INFO)


class InstagramBrowserClient:
Expand Down Expand Up @@ -123,7 +124,7 @@ def _next_story(self, authenticated_browser):
log.debug('[next_story] next story')
return button.click()
except Exception as error:
log.error(f'{error}', enable_traceback=False)
log.error(f'{error}')

if not found_btn:
# no more stories. exit
Expand Down
7 changes: 4 additions & 3 deletions automon/integrations/instagram/config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from automon import Logging
from automon.log import logger

from automon.helpers.osWrapper.environ import environ

log = Logging('InstagramConfig', level=Logging.INFO)
log = logger.logging.getLogger(__name__)
log.setLevel(logger.INFO)


class InstagramConfig(object):
Expand All @@ -16,7 +17,7 @@ def is_configured(self):
if self.login and self.password:
log.info(f'config ready')
return True
log.warning(f'missing login and password')
log.error(f'missing login and password')
return False

def __repr__(self):
Expand Down
5 changes: 3 additions & 2 deletions automon/integrations/instagram/stories.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

from automon.log.logger import Logging
from automon.log import logger
from automon.helpers.sleeper import Sleeper
from automon.integrations.seleniumWrapper.config import SeleniumConfig
from automon.integrations.seleniumWrapper.browser import SeleniumBrowser

from automon.integrations.minioWrapper import MinioClient

log = Logging(name='instagram', level=Logging.DEBUG)
log = logger.logging.getLogger(__name__)
log.setLevel(logger.DEBUG)


def authenticate(username, password, minio_client=None, retries=None):
Expand Down

0 comments on commit 55bbf68

Please sign in to comment.