dot sourcing but keeping log files in both scripts

My script runs a setup.ps1 script that gets a lot of general/config settings.
Among those, setup.ps1 assigns $logFile to be basically $'.ps1','.log') so that the log file is the same as the script with a log extension.
In my main script, I wish to do the same - write a log for any information I want to keep track of.  But I suspect, it will overwrite my $logFile variable - is that accurate?
If so, I assume my only option is to simply use another variable, correct?
Or I'm thinking about keeping one log file, but in my function to write to it, precede the data text with the source script name.
LVL 67
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
All that is true, because you dot-source, which makes the script the default scope. You can use a different name, or prefix one of the vars with $global: to give it a different scope. The scope needs to be provided every time you access the var.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.