Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# std.experimental.logger.multilogger

Source std/experimental/logger/multilogger.d

struct `MultiLoggerEntry`;
  This Element is stored inside the MultiLogger and associates a Logger to a string.
  string `name`;
    The name if the Logger
  Logger `logger`;
    The stored Logger
class `MultiLogger`: std.experimental.logger.core.Logger;
  MultiLogger logs to multiple Logger. The Loggers are stored in an Logger[] in their order of insertion.
  Every data logged to this `MultiLogger` will be distributed to all the Loggers inserted into it. This `MultiLogger` implementation can hold multiple Loggers with the same name. If the method removeLogger is used to remove a Logger only the first occurrence with that name will be removed.
  @safe this(const LogLevel `lv` = LogLevel.all);
    A constructor for the MultiLogger Logger.
    Parameters:

    LogLevel `lv` | The LogLevel for the MultiLogger. By default the LogLevel for MultiLogger is LogLevel.all.

    Example

        auto l1 = new MultiLogger(LogLevel.trace);

  protected MultiLoggerEntry[] `logger`;
    This member holds all Loggers stored in the MultiLogger.
    When inheriting from MultiLogger this member can be used to gain access to the stored Logger.
  @safe void `insertLogger`(string `name`, Logger `newLogger`);
    This method inserts a new Logger into the MultiLogger.
    Parameters:

    string `name` | The name of the Logger to insert.
    Logger `newLogger` | The Logger to insert.

  @safe Logger `removeLogger`(in char[] `toRemove`);
    This method removes a Logger from the MultiLogger.
    Parameters:

    char[] `toRemove` | The name of the Logger to remove. If the Logger is not found null will be returned. Only the first occurrence of a Logger with the given name will be removed.

    Returns:
    The removed Logger.

Copyright © 1999-2020 by the D Language Foundation | Page generated by Ddoc on Sun Jan 5 12:41:23 2020