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
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
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
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
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
I have got logger instance in App.d
void main()
{
FileLogger fLogger = new FileLogger("ErrorLog.txt");