This returns an array of formatters appropriate for the configuration.
 Depending on whether a log file is configured, this could be just the
 Airbrussh:ConsoleFormatter, or that plus the LogFileFormatter.
343379
def formatters(io)
      fmts = [Airbrussh::ConsoleFormatter.new(io, self)]
      fmts.unshift(Airbrussh::LogFileFormatter.new(log_file)) if log_file
      fmts
    end
926202
function getFormatter(oType) {
		var oFormatOptions;

		if (!oType.oFormat) {
			oFormatOptions = jQuery.extend({strictParsing : true}, oType.oFormatOptions);
			oFormatOptions.UTC = true;
			oType.oFormat = DateFormat.getTimeInstance(oFormatOptions);
		}
		return oType.oFormat;
	}
1213693
public List<I_CmsFormatterBean> getDisplayFormatters() {

        if (m_displayFormatters == null) {
            List<I_CmsFormatterBean> formatters = new ArrayList<I_CmsFormatterBean>(
                Collections2.filter(m_allFormatters, new IsDisplay()));
            if (formatters.size() > 1) {
                Collections.sort(formatters, new Comparator<I_CmsFormatterBean>() {

                    public int compare(I_CmsFormatterBean o1, I_CmsFormatterBean o2) {

                        return o1.getRank() == o2.getRank() ? 0 : (o1.getRank() < o2.getRank() ? -1 : 1);
                    }
                });
            }
            m_displayFormatters = Collections.unmodifiableList(formatters);
        }
        return m_displayFormatters;
    }
479861
public function getFormatters()
    {
        if (null === static::$formatters) {
            static::$formatters = array();
            $dirs = array();
            // if we'are using Composer, include these formatters
            if ($composer = $this->getComposer()) {
                $vendorDir = realpath(__DIR__.'/../../../..');
                if (is_readable($installed = $vendorDir.'/composer/installed.json')) {
                    $packages = json_decode(file_get_contents($installed), true);
                    foreach ($packages as $package) {
                        if (isset($package['name']) && is_dir($dir = $vendorDir.DIRECTORY_SEPARATOR.$package['name'])) {
                            /**
                             * Check for extended package extra attribute to customize
                             * formatter inclusion.
                             *
                             * An example to include formatter using class:
                             * {
                             *     "extra" : {
                             *         "mysql-workbench-schema-exporter" : {
                             *             "formatters" : {
                             *                 "my-simple" : "\\My\\Simple\\Formatter",
                             *                 "my-simple2" : "\\My\\Simple2\\Formatter"
                             *             }
                             *         }
                             *     }
                             * }
                             *
                             * An example include formatter using namespace:
                             * {
                             *     "extra" : {
                             *         "mysql-workbench-schema-exporter" : {
                             *             "namespaces" : {
                             *                 "lib/My/Exporter" : "\\Acme\\My\\Exporter",
                             *             }
                             *         }
                             *     }
                             * }
                             */
                            if (isset($package['extra']) && isset($package['extra']['mysql-workbench-schema-exporter'])) {
                                if (is_array($options = $package['extra']['mysql-workbench-schema-exporter'])) {
                                    if (isset($options['formatters']) && is_array($options['formatters'])) {
                                        foreach ($options['formatters'] as $name => $class) {
                                            $this->registerFormatter($name, $class);
                                        }
                                    }
                                    if (isset($options['namespaces']) && is_array($options['namespaces'])) {
                                        foreach ($options['namespaces'] as $lib => $namespace) {
                                            $dirs[$dir.DIRECTORY_SEPARATOR.$lib] = $namespace;
                                        }
                                    }
                                    continue;
                                }
                            }
                            $dirs[] = $dir;
                        }
                    }
                }
            } else {
                $dirs[] = realpath(__DIR__.'/../..');
            }
            $this->scanFormatters($dirs);
        }

        return static::$formatters;
    }
710904
private Multimap<String, I_CmsFormatterBean> getFormattersByType() {

        if (m_formattersByType == null) {
            ArrayListMultimap<String, I_CmsFormatterBean> formattersByType = ArrayListMultimap.create();
            for (I_CmsFormatterBean formatter : m_formatters.values()) {
                for (String typeName : formatter.getResourceTypeNames()) {
                    formattersByType.put(typeName, formatter);
                }
            }
            m_formattersByType = formattersByType;
        }
        Multimap<String, I_CmsFormatterBean> result = Multimaps.unmodifiableMultimap(m_formattersByType);
        return result;
    }
875011
public function getFormatters(): ArrayObject
    {
        $arr = new ArrayObject();
        foreach ($this->columns as $key => $column) {
            if (($formatter = $column->getFormatter()) !== null) {
                $arr->offsetSet($key, $formatter);
            }
        }

        return $arr;
    }
656331
public CmsFormatterConfiguration getFormatters(CmsObject cms, CmsResource res) {

        if (CmsResourceTypeFunctionConfig.isFunction(res)) {

            CmsFormatterConfigurationCacheState formatters = getCachedFormatters();
            I_CmsFormatterBean function = formatters.getFormatters().get(res.getStructureId());
            if (function != null) {
                return CmsFormatterConfiguration.create(cms, Collections.singletonList(function));
            } else {
                if ((!res.getStructureId().isNullUUID())
                    && cms.existsResource(res.getStructureId(), CmsResourceFilter.IGNORE_EXPIRATION)) {
                    // usually if it's just been created, but not added to the configuration cache yet
                    CmsFormatterBeanParser parser = new CmsFormatterBeanParser(cms, new HashMap<>());
                    try {
                        function = parser.parse(
                            CmsXmlContentFactory.unmarshal(cms, cms.readFile(res)),
                            res.getRootPath(),
                            "" + res.getStructureId());
                        return CmsFormatterConfiguration.create(cms, Collections.singletonList(function));
                    } catch (Exception e) {
                        LOG.warn(e.getLocalizedMessage(), e);
                        return CmsFormatterConfiguration.EMPTY_CONFIGURATION;
                    }

                } else {
                    // if a new function has been dragged on the page, it doesn't exist in the VFS yet, so we need a different
                    // instance as a replacement
                    CmsResource defaultFormatter = CmsFunctionRenderer.getDefaultFunctionInstance(cms);
                    if (defaultFormatter != null) {
                        I_CmsFormatterBean defaultFormatterBean = formatters.getFormatters().get(
                            defaultFormatter.getStructureId());
                        return CmsFormatterConfiguration.create(cms, Collections.singletonList(defaultFormatterBean));
                    } else {
                        LOG.warn("Could not read default formatter for functions.");
                        return CmsFormatterConfiguration.EMPTY_CONFIGURATION;
                    }
                }
            }
        } else {
            try {
                int resTypeId = res.getTypeId();
                return getFormatters(
                    cms,
                    OpenCms.getResourceManager().getResourceType(resTypeId),
                    getFormattersFromSchema(cms, res));
            } catch (CmsLoaderException e) {
                LOG.warn(e.getLocalizedMessage(), e);
                return CmsFormatterConfiguration.EMPTY_CONFIGURATION;
            }
        }
    }
1266752
public function getFormatter()
    {
        $debug = $this->getOption('debug');

        return isset($this->formatters[$debug])
            ? $this->formatters[$debug]
            : $this->initializeFormatter();
    }
95974
private static String formatLogParam(Array obj) {
		String result="";
		try {
			result= "(array of type"+obj.getBaseTypeName().length()+")";
		} catch (SQLException e) {
			result = "(array of unknown type)";
		}
		return result;
	}
227446
private Object getFormatter() {
        Object f = iFormatter;

        if (f == null) {
            if (iElementPairs.size() == 2) {
                Object printer = iElementPairs.get(0);
                Object parser = iElementPairs.get(1);

                if (printer != null) {
                    if (printer == parser || parser == null) {
                        f = printer;
                    }
                } else {
                    f = parser;
                }
            }

            if (f == null) {
                f = new Composite(iElementPairs);
            }

            iFormatter = f;
        }

        return f;
    }
111430
@Override
    public String[] getFormats() {
        final String[] formats = new String[Format.values().length];
        int i = 0;
        for (final Format format : Format.values()) {
            formats[i++] = format.name();
        }
        return formats;
    }
739719
function formatConfig(config) {
  var result = {
    appenders: {
      out: { type: 'console' }
    },
    categories: {
      default: {
        appenders: ['out'],
        level: 'info'
      }
    }
  };
  var _iteratorNormalCompletion = true;
  var _didIteratorError = false;
  var _iteratorError = undefined;

  try {
    for (var _iterator = config.appenders[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
      var appender = _step.value;

      result.appenders[appender.type] = Object.assign({}, appender);(result.categories[appender.category] || (result.categories[appender.category] = {
        appenders: [],
        level: 'info'
      }))['appenders'].push(appender.type);
    }
  } catch (err) {
    _didIteratorError = true;
    _iteratorError = err;
  } finally {
    try {
      if (!_iteratorNormalCompletion && _iterator.return) {
        _iterator.return();
      }
    } finally {
      if (_didIteratorError) {
        throw _iteratorError;
      }
    }
  }

  return result;
}
1141981
function formatConfig (config) {
  _.defaults(config, {debug: false, plugins: []})

  config.debugOptions = config.debugOptions || {}
  config.connectedTeams = new Set()

  if (!Array.isArray(config.plugins)) {
    config.plugins = [config.plugins]
  }

  config.scopes = _.chain(config.plugins)
    .map('scopes')
    .flatten()
    .concat(_.isArray(config.scopes) ? config.scopes : [])
    .uniq()
    .remove(_.isString.bind(_))
    .value()

  config.isSlackApp = !config.slackToken

  if (!config.slackToken && !(config.clientId && config.clientSecret && config.port)) {
    logger.error(`Missing configuration. Config must include either slackToken AND/OR clientId, clientSecret, and port`)
    process.exit(1)
  }
}
1088704
function TableFormatter(options) {
  const table = new Table(options);
  this.format = format;
  function format(result, formatOptions) {
    let data = [];
    _.each(result, function (item) {
      data.push(_.values(_.pick(item, options.values)));
    });
    if (formatOptions.format === 'csv') {
     _.each(data, function(row) {
       console.log(row.join(','));
     });
    } else if ( formatOptions.format === 'json') {
      console.log(JSON.stringify(result));
    } else {
      table.push.apply(table, data);
      console.log(table.toString());
    }
  }
}
492480
def logging_config(logpath=None,
                   level=logging.DEBUG,
                   console_level=logging.INFO,
                   no_console=False):
    
    logger = logging.getLogger('nli')
    # Remove all the current handlers
    for handler in logger.handlers:
        logger.removeHandler(handler)
    logger.handlers = []
    logger.propagate = False
    logger.setLevel(logging.DEBUG)

    formatter = logging.Formatter('%(filename)s:%(funcName)s: %(message)s')

    if logpath is not None:
        print('All Logs will be saved to {}'.format(logpath))
        logfile = logging.FileHandler(logpath, mode='w')
        logfile.setLevel(level)
        logfile.setFormatter(formatter)
        logger.addHandler(logfile)

    if not no_console:
        # Initialze the console logging
        logconsole = logging.StreamHandler()
        logconsole.setLevel(console_level)
        logconsole.setFormatter(formatter)
        logger.addHandler(logconsole)
188665
private Map<Class<?>, Formatter> findFormatMethods()
    {
        final Map<Class<?>, Formatter> formats = new HashMap<Class<?>, Formatter>();
        for (Method method : this.getClass().getMethods())
        {
            Format formatAnnotation = method.getAnnotation(Format.class);
            if (formatAnnotation != null)
            {
                Class<?>[] parameterTypes = method.getParameterTypes();
                if (parameterTypes.length == 0)
                {
                    throw new InvalidFormatMethodException(getClass(), method, "Format methods must take at least 1 parameter!");
                }
                formats.put(parameterTypes[0], createFormatter(method, parameterTypes, formatAnnotation.value()));
            }
        }
        return formats;
    }
592470
private Map<String, String> getFormattingOptions(String newConfigFile) throws MojoExecutionException {
        if (this.useEclipseDefaults) {
            getLog().info("Using Ecipse Defaults");
            // Use defaults only for formatting
            Map<String, String> options = new HashMap<>();
            options.put(JavaCore.COMPILER_SOURCE, this.compilerSource);
            options.put(JavaCore.COMPILER_COMPLIANCE, this.compilerCompliance);
            options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, this.compilerTargetPlatform);
            return options;
        }

        return getOptionsFromConfigFile(newConfigFile);
    }