Add metadata to every bugsnag log
343699
private function addCommonMetaData()
    {
        $this->bugsnag->registerCallback(function ($report) {
            $report->addMetaData([
                'META DATA' => [
                    'store_url' => $this->storeManager->getStore()->getBaseUrl(
                        \Magento\Framework\UrlInterface::URL_TYPE_WEB
                    )
                ]
            ]);
        });
    }
1081740
def add_environment_information(meta):
        """"""
        meta["timestamp"] = datetime.utcnow().isoformat(" ")
        meta["platform"] = platform.system()
        meta["release"] = platform.release()
        meta["python"] = platform.python_version()
        meta["packages"] = get_pkg_info("memote")
525010
def log_config(verbose=1):
    """"""
    # ENH:
    # - do print levelname before DEBUG and WARNING
    # - instead of %module, name the currently running script
    #   - make a subclass of logging.handlers.X instead?
    #   - tweak %root?
    #   - take __file__ as an argument?
    if verbose == 0:
        level = logging.WARNING
        fmt = "%(module)s: %(message)s"
    elif verbose == 1:
        level = logging.INFO
        fmt = "%(module)s [@%(lineno)s]: %(message)s"
    else:
        level = logging.DEBUG
        fmt = "%(module)s [%(lineno)s]: %(levelname)s: %(message)s"
    logging.basicConfig(format=fmt, level=level)
77732
def _create_import_log(items):
    
    log = []

    for item in items:
        if isinstance(item, MetadataFile):
            log.append(
                "Metadata file '%s' successfully imported." % item.filename
            )
        elif isinstance(item, EbookFile):
            log.append(
                "Ebook file '%s' successfully imported." % item.filename
            )
        elif isinstance(item, DataPair):
            meta = item.metadata_file.filename
            data = item.ebook_file.filename
            log.extend([
                "Metadata and data files paired to epub. import request:",
                "\tMetadata file '%s' successfully imported." % meta,
                "\tEbook file '%s' successfully imported." % data
            ])

    return log
324680
def upload_debug(self):
        """"""
        if os.path.exists(self.log_fname):
            api = InternalApi()
            api.set_current_run_id(self.id)
            pusher = FilePusher(api)
            pusher.update_file("wandb-debug.log", self.log_fname)
            pusher.file_changed("wandb-debug.log", self.log_fname)
            pusher.finish()
570436
def do_bugout(self, args):
        """"""
        args = args.split()
        if _debug: ConsoleCmd._debug("do_bugout %r", args)

        # get the logger name and logger
        if args:
            loggerName = args[0]
            if loggerName in logging.Logger.manager.loggerDict:
                logger = logging.getLogger(loggerName)
            else:
                logger = None
        else:
            loggerName = '__root__'
            logger = logging.getLogger()

        # remove the logging handler
        if not logger:
            self.stdout.write("not a valid logger name\n")
        elif not loggerName in self.handlers:
            self.stdout.write("no handler for %s\n" % loggerName)
        else:
            handler = self.handlers[loggerName]
            del self.handlers[loggerName]

            # see if this (or its parent) is a module level logger
            if hasattr(logger, 'globs'):
                logger.globs['_debug'] -= 1
            elif hasattr(logger.parent, 'globs'):
                logger.parent.globs['_debug'] -= 1

            # remove it from the logger
            logger.removeHandler(handler)
            self.stdout.write("handler to %s removed\n" % loggerName)
        self.stdout.write("\n")
599543
function build_meta_information(object) {
      var res = {
        "timestamp": object.timestamp,
        "version": object.version,
        "changeset": object.changeset,
        "user": object.user,
        "uid": object.uid
      };
      for (var k in res)
        if (res[k] === undefined)
          delete res[k];
      return res;
    }
1166241
def ready(ctx, quiet):
    """"""
    user_config = ctx.obj
    cached_prs = {}

    for target in sorted(get_valid_checks()):
        # get the name of the current release tag
        cur_version = get_version_string(target)
        target_tag = get_release_tag_string(target, cur_version)

        # get the diff from HEAD
        diff_lines = get_commits_since(target, target_tag)

        # get the number of PRs that could be potentially released
        # Only show the ones that have a changelog label that isn't no-changelog
        pr_numbers = parse_pr_numbers(diff_lines)

        shippable_prs = 0
        for pr_num in pr_numbers:
            try:
                if pr_num in cached_prs:
                    changelog_labels = cached_prs[pr_num]
                    if len(changelog_labels) != 1:
                        continue
                else:
                    payload = get_pr(pr_num, user_config)
                    changelog_labels = get_changelog_types(payload)
                    cached_prs[pr_num] = changelog_labels

                    if not changelog_labels:
                        echo_warning(
                            'PR #{} has no changelog label attached, please add one! Skipping...'.format(pr_num)
                        )
                        continue

                    if len(changelog_labels) > 1:
                        echo_warning(
                            'Multiple changelog labels found attached to PR #{}, '
                            'please only use one! Skipping...'.format(pr_num)
                        )
                        continue

                if changelog_labels[0] != CHANGELOG_TYPE_NONE:
                    shippable_prs += 1
            except Exception as e:
                echo_failure('Unable to fetch info for PR #{}: {}'.format(pr_num, e))
                continue

        if shippable_prs:
            if quiet:
                msg = target
            else:
                msg = 'Check {} has {} out of {} merged PRs that could be released' ''.format(
                    target, shippable_prs, len(pr_numbers)
                )
            echo_info(msg)
56719
def crashlog_clean(name, timestamp, size, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('crashlog:clean', **{
        'storage': ctx.repo.create_secure_service('storage'),
        'name': name,
        'size': size,
        'timestamp': timestamp,
    })
1052753
def fetch_all_bug_details(self, bug_ids):
        """"""
        min = 0
        max = 600
        bugs_list = []
        bug_ids_length = len(bug_ids)

        while bug_ids_length >= min and bug_ids_length > 0:
            data = self.fetch_bug_details(bug_ids[min:max])
            if data:
                bugs_list += data
            min = max
            max = max + 600

        return {bug['id']: bug for bug in bugs_list} if len(bugs_list) else None
513391
public static void infoAndDebug(Logger log, String methodName,
            Object... params) {
        if (!log.isInfoEnabled())
            return;
        int length = params.length;
        Object[] newParams = new Object[length];
        boolean hasCollection = false;
        for (int i = 0; i < length; i++) {
            if (params[i] instanceof Collection) {
                newParams[i] = (((Collection<?>) params[i]).size());
                hasCollection = true;
            } else
                newParams[i] = params[i];
        }
        if (hasCollection)
            log.info(buildMethodLogString(methodName, newParams));
        log.debug(buildMethodLogString(methodName, params));
    }
1322151
def _add_log_tab(self):
        """"""

        # text_tab = "Log (Alt+&{})".format(len(self.pages)+1)
        text_tab = "Log"

        self.pages.append(MyPage(text_tab=text_tab))

        # ### Log tab
        te = self.textEdit_log = self.keep_ref(QTextEdit())
        te.setReadOnly(True)
        self.tabWidget.addTab(te, text_tab)
97192
public function setCommonMetaData()
    {
        if ($boltTraceId = $this->request->getHeader(ConfigHelper::BOLT_TRACE_ID_HEADER)) {
            $this->bugsnag->registerCallback(function ($report) use ($boltTraceId) {
                $report->setMetaData([
                    'META DATA' => [
                        'bolt_trace_id' => $boltTraceId,
                    ]
                ]);
            });
        }
    }
1082316
public static void addTagMetaData(ConfigWebImpl cw, lucee.commons.io.log.Log log) {
	if (true) return;

	PageContextImpl pc = null;
	try {
	    pc = ThreadUtil.createPageContext(cw, DevNullOutputStream.DEV_NULL_OUTPUT_STREAM, "localhost", "/", "", new Cookie[0], new Pair[0], null, new Pair[0], new StructImpl(),
		    false, -1);

	}
	catch (Throwable t) {
	    ExceptionUtil.rethrowIfNecessary(t);
	    return;
	}
	PageContext orgPC = ThreadLocalPageContext.get();
	try {
	    ThreadLocalPageContext.register(pc);

	    // MUST MOST of them are the same, so this is a huge overhead
	    _addTagMetaData(pc, cw, CFMLEngine.DIALECT_CFML);
	    _addTagMetaData(pc, cw, CFMLEngine.DIALECT_LUCEE);

	}
	catch (Exception e) {
	    XMLConfigWebFactory.log(cw, log, e);
	}
	finally {
	    pc.getConfig().getFactory().releaseLuceePageContext(pc, true);
	    ThreadLocalPageContext.register(orgPC);
	}
    }
573907
def import_metadata(module_paths):
    """"""
    cwd = os.getcwd()
    if cwd not in sys.path:
        sys.path.insert(0, cwd)
    modules = []
    try:
        for path in module_paths:
            modules.append(import_module(path))
    except ImportError as e:
        err = RuntimeError('Could not import {}: {}'.format(path, str(e)))
        raise_from(err, e)
    return modules
958054
def fetch_bug_details(self, bug_ids):
        """"""

        params = {'include_fields': 'product, component, priority, whiteboard, id'}
        params['id'] = bug_ids
        try:
            response = self.session.get(settings.BZ_API_URL + '/rest/bug', headers=self.session.headers,
                                        params=params, timeout=30)
            response.raise_for_status()
        except RequestException as e:
            logger.warning('error fetching bugzilla metadata for bugs due to {}'.format(e))
            return None

        if response.headers['Content-Type'] == 'text/html; charset=UTF-8':
            return None

        data = response.json()
        if 'bugs' not in data:
            return None

        return data['bugs']
266858
function _setupDebugHelpers() {
        window.ld = LiveDevelopment;
        window.i = Inspector;
        window.report = function report(params) { window.params = params; console.info(params); };
    }