# Logging identifier name and value

**URL:** <https://forum.inductiveautomation.com/t/logging-identifier-name-and-value/95216>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [August 27, 2024, 3:37pm UTC](https://forum.inductiveautomation.com/t/logging-identifier-name-and-value/95216 "2024-08-27T15:37:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![olivier.cote](https://avatars.discourse-cdn.com/v4/letter/o/e9bcb4/32.png) [@olivier.cote](https://forum.inductiveautomation.com/u/olivier.cote)\
**Post date:** [August 27, 2024, 3:37pm UTC](https://forum.inductiveautomation.com/t/logging-identifier-name-and-value/95216/1 "2024-08-27T15:37:38Z")

</div>

I'm looking to have a function were I can pass some arguments and it would print the name of the identifier and the value (in string) of it.

With the folwing code, I work perfect when I am in the script console.

But when I try to attach this into a script so I can call it from anywhere, the namespace globals() does not hold the identifier name.

Any idea ?

* * *

```python
foo1 = 1
foo2 = "22"
foo3 = ['333']

def printTags(*args):	
        #Return the name of an identifier
	def namestr(obj):
		namespace = globals()
		objName = [name for name in namespace if namespace[name] is obj]		
		return str(objName)	

	#iterate all the args to print the name of the identifier and the value	
	for i in range(0, len(args)):
		logInfo = namestr(args[i]) + ": " + str(args[i])		
		system.util.getLogger("Log").warn(logInfo) 
		print (logInfo) #used for debugging	
		
printTags(foo1, foo2, foo3)

```
