-
Notifications
You must be signed in to change notification settings - Fork 11
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
64b414f
commit 430e126
Showing
4 changed files
with
90 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
"""Hello World implementation using MILC. | ||
PYTHON_ARGCOMPLETE_OK | ||
""" | ||
import logging | ||
|
||
from milc import set_metadata | ||
|
||
# Setup external logger | ||
logging.basicConfig(level=logging.DEBUG) | ||
logger = logging.getLogger('custom_logger') | ||
|
||
set_metadata(logger=logging.getLogger('custom_logger')) | ||
|
||
# Import milc | ||
from milc import cli | ||
|
||
|
||
@cli.entrypoint('Test a non-MILC logger.') | ||
def main(cli): | ||
cli.log.info('Hello Info World!') | ||
cli.log.debug('Hello Debug World!') | ||
|
||
|
||
if __name__ == '__main__': | ||
cli() |
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
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,8 @@ | ||
from .common import check_assert, check_command, check_returncode | ||
|
||
|
||
def test_custom_logger(): | ||
result = check_command('./custom_logger') | ||
check_returncode(result) | ||
check_assert(result, 'INFO:custom_logger:Hello Info World!' in result.stdout) | ||
check_assert(result, 'DEBUG:custom_logger:Hello Debug World!' in result.stdout) |