Re: What is best way to get see function from separate file

2016-04-10 Thread Jonathan Villa via Digitalmars-d-learn
On Sunday, 10 April 2016 at 18:57:45 UTC, Suliman wrote: I like it. Am i right understand that it prevent creation unneeded of new instance of logger? No, you need to pass a valid instance in foo(...), It should have been created before the call to foo(...). I prefer the second way (separ

Re: What is best way to get see function from separate file

2016-04-10 Thread Suliman via Digitalmars-d-learn
You could pass an argument of type FileLogger (probably better a pointer?) foo ( FileLogger log ) { } I like it. Am i right understand that it prevent creation unneeded of new instance of logger? And what problems I can get if I will create new instance of logger in every stand alone functi

Re: What is best way to get see function from separate file

2016-04-10 Thread Jonathan Villa via Digitalmars-d-learn
On Sunday, 10 April 2016 at 18:26:57 UTC, Suliman wrote: Sorry for wrong posting! I have got logger instance in App.d void main() { ... FileLogger fLogger = new FileLogger("ErrorLog.txt"); foo(); } utils.d: foo() { // I need logging here } Also I have file utils.d that include stand-alone f

Re: What is best way to get see function from separate file

2016-04-10 Thread Jonathan Villa via Digitalmars-d-learn
On Sunday, 10 April 2016 at 18:36:19 UTC, Jonathan Villa wrote: On Sunday, 10 April 2016 at 18:26:57 UTC, Suliman wrote: Other whay is to leave FileLogger instance in a separated module: logger.d public static FileLogger fLogger; App.d import logger; //the module void main() { // generate

Re: What is best way to get see function from separate file

2016-04-10 Thread Suliman via Digitalmars-d-learn
Sorry for wrong posting! I have got logger instance in App.d void main() { ... FileLogger fLogger = new FileLogger("ErrorLog.txt"); foo(); } utils.d: foo() { // I need logging here } Also I have file utils.d that include stand-alone functions that is not in classes. In one of them I need to

What is best way to get see function from separate file

2016-04-10 Thread Suliman via Digitalmars-d-learn
I have got logger instance in App.d void main() { FileLogger fLogger = new FileLogger("ErrorLog.txt");