fix: log to stderr if logger is not set instead of stdout
Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
This commit is contained in:
parent
2082e5bbf7
commit
0a81f64009
@ -1,5 +1,5 @@
|
|||||||
## Copyright 2012-2016 David Robillard <d@drobilla.net>
|
## Copyright 2012-2016 David Robillard <d@drobilla.net>
|
||||||
## Copyright 2012-2016 Christopher Arndt <info@chrisarndt.de>
|
## Copyright 2026 Christopher Arndt <info@chrisarndt.de>
|
||||||
## SPDX-License-Identifier: ISC
|
## SPDX-License-Identifier: ISC
|
||||||
##
|
##
|
||||||
## Interface for plugins to log via the host.
|
## Interface for plugins to log via the host.
|
||||||
@ -48,10 +48,11 @@ proc setup*(logger: var Logger, log: ptr Log, map: ptr UridMap): bool =
|
|||||||
|
|
||||||
return not (log.isNil or map.isNil)
|
return not (log.isNil or map.isNil)
|
||||||
|
|
||||||
|
|
||||||
proc log*(logger: Logger, `type`: Urid, msg: string, nl: string = "\n") =
|
proc log*(logger: Logger, `type`: Urid, msg: string, nl: string = "\n") =
|
||||||
let mmsg = msg & nl
|
let mmsg = msg & nl
|
||||||
if logger.pLog.isNil:
|
if logger.pLog.isNil:
|
||||||
echo(mmsg)
|
stderr.write(mmsg)
|
||||||
else:
|
else:
|
||||||
logger.pLog.printf(logger.pLog.handle, `type`, mmsg.cstring)
|
logger.pLog.printf(logger.pLog.handle, `type`, mmsg.cstring)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user