-
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
1 parent
0ca63aa
commit 4fd3a50
Showing
7 changed files
with
99 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import logging | ||
from typing import Union | ||
|
||
from falca.app import ASGI, WSGI | ||
from falca.plugins.base import BasePlugin | ||
|
||
|
||
class Logger(BasePlugin): | ||
name = "logging" | ||
|
||
def __init__(self, app: Union[WSGI, ASGI]) -> None: | ||
super().__init__(app) | ||
logging.basicConfig(level=logging.INFO) | ||
self._log = logging.getLogger(app.import_name) | ||
|
||
def info(self, *args, **kwds): | ||
self._log.info(*args, **kwds) | ||
|
||
def error(self, *args, **kwds): | ||
self._log.error(*args, **kwds) | ||
|
||
def warning(self, *args, **kwds): | ||
self._log.warning(*args, **kwds) | ||
|
||
def exception(self, *args, **kwds): | ||
self._log.exception(*args, **kwds) | ||
|
||
def debug(self, *args, **kwds): | ||
self._log.debug(*args, **kwds) |
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,29 @@ | ||
import logging | ||
from typing import Union | ||
|
||
from falca.app import ASGI, WSGI | ||
from falca.plugins.base import BasePlugin | ||
|
||
|
||
class Logger(BasePlugin): | ||
name = "logging" | ||
|
||
def __init__(self, app: Union[WSGI, ASGI]) -> None: | ||
super().__init__(app) | ||
logging.basicConfig(level=logging.INFO) | ||
self._log = logging.getLogger(app.import_name) | ||
|
||
def info(self, *args, **kwds): | ||
self._log.info(*args, **kwds) | ||
|
||
def error(self, *args, **kwds): | ||
self._log.error(*args, **kwds) | ||
|
||
def warning(self, *args, **kwds): | ||
self._log.warning(*args, **kwds) | ||
|
||
def exception(self, *args, **kwds): | ||
self._log.exception(*args, **kwds) | ||
|
||
def debug(self, *args, **kwds): | ||
self._log.debug(*args, **kwds) |
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,5 @@ | ||
class BasePlugin: | ||
name: str = None | ||
|
||
def __init__(self, app) -> None: | ||
self.app = app |
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