-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update approach to logging in connector component (#2809)
Co-authored-by: Jedr Blaszyk <[email protected]>
- Loading branch information
1 parent
4f6ca9b
commit 6e74c3a
Showing
9 changed files
with
293 additions
and
62 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
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 @@ | ||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the Elastic License 2.0; | ||
# you may not use this file except in compliance with the Elastic License 2.0. | ||
# | ||
import logging | ||
|
||
import ecs_logging | ||
|
||
root_logger = logging.getLogger("agent_component") | ||
handler = logging.StreamHandler() | ||
handler.setFormatter(ecs_logging.StdlibFormatter()) | ||
root_logger.addHandler(handler) | ||
root_logger.setLevel(logging.INFO) | ||
|
||
|
||
def get_logger(module): | ||
logger = root_logger.getChild(module) | ||
|
||
if logger.hasHandlers(): | ||
return logger | ||
|
||
logger.addHandler(handler) | ||
|
||
return logger | ||
|
||
|
||
def update_logger_level(log_level): | ||
root_logger.setLevel(log_level) |
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
Oops, something went wrong.