2020
2121import solnlib .splunkenv as sp
2222
23- from solnlib .log import Logs
23+ from solnlib .utils import get_solnlib_logger
2424
25- logger = Logs (). get_logger (__name__ )
25+ logger = get_solnlib_logger (__name__ )
2626
2727
2828def _parse_modinput_configs (root , outer_block , inner_block ):
@@ -65,7 +65,7 @@ def _parse_modinput_configs(root, outer_block, inner_block):
6565
6666 confs = root .getElementsByTagName (outer_block )
6767 if not confs :
68- logger .error ("Invalid config, missing %s section" , outer_block )
68+ logger () .error ("Invalid config, missing %s section" , outer_block )
6969 raise Exception (f"Invalid config, missing { outer_block } section" )
7070
7171 configs = []
@@ -74,7 +74,7 @@ def _parse_modinput_configs(root, outer_block, inner_block):
7474 config = {}
7575 stanza_name = stanza .getAttribute ("name" )
7676 if not stanza_name :
77- logger .error ("Invalid config, missing name" )
77+ logger () .error ("Invalid config, missing name" )
7878 raise Exception ("Invalid config, missing name" )
7979
8080 config ["name" ] = stanza_name
@@ -110,13 +110,13 @@ def parse_modinput_configs(config_str):
110110 for tag in meta_configs .keys ():
111111 nodes = doc .getElementsByTagName (tag )
112112 if not nodes :
113- logger .error ("Invalid config, missing %s section" , tag )
113+ logger () .error ("Invalid config, missing %s section" , tag )
114114 raise Exception ("Invalid config, missing %s section" , tag )
115115
116116 if nodes [0 ].firstChild and nodes [0 ].firstChild .nodeType == nodes [0 ].TEXT_NODE :
117117 meta_configs [tag ] = nodes [0 ].firstChild .data
118118 else :
119- logger .error ("Invalid config, expect text ndoe" )
119+ logger () .error ("Invalid config, expect text ndoe" )
120120 raise Exception ("Invalid config, expect text ndoe" )
121121
122122 if doc .nodeName == "input" :
@@ -143,7 +143,7 @@ def get_modinput_configs_from_cli(modinput, modinput_stanza=None):
143143 cli , stdout = subprocess .PIPE , stderr = subprocess .PIPE
144144 ).communicate ()
145145 if err :
146- logger .error ("Failed to get modinput configs with error: %s" , err )
146+ logger () .error ("Failed to get modinput configs with error: %s" , err )
147147 return None , None
148148 else :
149149 return parse_modinput_configs (out )
@@ -155,7 +155,7 @@ def get_modinput_config_str_from_stdin():
155155 try :
156156 return sys .stdin .read (5000 )
157157 except Exception :
158- logger .error (traceback .format_exc ())
158+ logger () .error (traceback .format_exc ())
159159 raise
160160
161161
0 commit comments