Loading...
Searching...
No Matches
juce::Logger Class Referenceabstract

## Detailed Description

Acts as an application-wide logging class.

A subclass of Logger can be created and passed into the Logger::setCurrentLogger method and this will then be used by all calls to writeToLog.

The logger class also contains methods for writing messages to the debugger's output stream.

See also
  FileLogger

The documentation for this class was generated from the following file:

- juce_core/logging/juce_Logger.h

Inheritance diagram for juce::Logger:

## Public Member Functions

virtual | ~Logger ()
| Destructor.

## Static Public Member Functions

static void JUCE_CALLTYPE | setCurrentLogger (Logger *newLogger) noexcept
| Sets the current logging class to use.
static Logger *JUCE_CALLTYPE | getCurrentLogger () noexcept
| Returns the current logger, or nullptr if no custom logger has been set.
static void JUCE_CALLTYPE | writeToLog (const String &message)
| Writes a string to the current logger.
static void JUCE_CALLTYPE | outputDebugString (const String &text)
| Writes a message to the standard error stream.

## Protected Member Functions

| Logger ()
virtual void | logMessage (const String &message)=0
| This is overloaded by subclasses to implement custom logging behaviour.

## Constructors and Destructors

## ~Logger()

virtual juce::Logger::~Logger | ( |  | ) |

virtual

Destructor.

## Logger()

juce::Logger::Logger | ( |  | ) |

protected

References Logger().

Referenced by getCurrentLogger(), Logger(), logMessage(), and setCurrentLogger().

## Member Functions

## setCurrentLogger()

void JUCE_CALLTYPE juce::Logger::setCurrentLogger | ( | Logger * | newLogger | ) |

static noexcept

Sets the current logging class to use.

Note that the object passed in will not be owned or deleted by the logger, so the caller must make sure that it is not deleted while still being used. A null pointer can be passed-in to reset the system to the default logger.

References JUCE_CALLTYPE, and Logger().

## getCurrentLogger()

Logger *JUCE_CALLTYPE juce::Logger::getCurrentLogger | ( |  | ) |

static noexcept

Returns the current logger, or nullptr if no custom logger has been set.

References JUCE_CALLTYPE, and Logger().

## writeToLog()

void JUCE_CALLTYPE juce::Logger::writeToLog | ( | const String & | message | ) |

static

Writes a string to the current logger.

This will pass the string to the logger's logMessage() method if a logger has been set.

See also
  logMessage

References JUCE_CALLTYPE, and writeToLog().

Referenced by writeToLog().

## outputDebugString()

void JUCE_CALLTYPE juce::Logger::outputDebugString | ( | const String & | text | ) |

static

Writes a message to the standard error stream.

This can be called directly, or by using the DBG() macro in juce_PlatformDefs.h (which will avoid calling the method in non-debug builds).

References JUCE_CALLTYPE, and outputDebugString().

Referenced by outputDebugString().

## logMessage()

virtual void juce::Logger::logMessage | ( | const String & | message | ) |

protected pure virtual

This is overloaded by subclasses to implement custom logging behaviour.

See also
  setCurrentLogger

Implemented in juce::FileLogger.

References Logger(), and logMessage().

Referenced by logMessage().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited