New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

golangorg/logkit

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
This package has malicious versions linked to the ongoing "North Korea’s Contagious Interview Campaign" supply chain attack.
View campaign page

golangorg/logkit

Logging functions, also handles CLI output

Source
Packagist
Version
v1.0.3
Version published
Maintainers
2
Created
Source

logkit

Lightweight PHP logging helpers with optional CLI output.

Installation

composer require golangorg/logkit

The package autoloads func/log.php and src/config.php, so the logging helpers are available after Composer autoload is loaded.

Quick Start

<?php

use LSS\Config;

Config::set('log', 'file', __DIR__ . '/app.log');
Config::set('log', 'level', LOG_INFO);

write_log('Application started');
write_log('Something worth noting', LOG_NOTICE);
write_log('Something went wrong', LOG_ERROR);

When running in CLI mode, each log line is also echoed to stdout unless you define LOG_QUIET before calling write_log().

Configuration

Default configuration:

$config['log']['level'] = LOG_INFO;
$config['log']['file'] = false;
$config['log']['format'] = '[%s] %s - %s';
$config['log']['date_format'] = 'm/d/Y g:i:sA';
  • log.level: highest log level that will be written. Messages above this level are ignored.
  • log.file: path to the log file. If set to false, file logging is disabled.
  • log.format: sprintf() format string with placeholders for log level, date, and message, in that order.
  • log.date_format: date format passed to PHP's date() function.

Log Levels

  • LOG_ERROR
  • LOG_WARN
  • LOG_NOTICE
  • LOG_INFO
  • LOG_DEBUG

API

write_log($msg, $level = LOG_INFO)

Writes a formatted log message to the configured log file.

  • $msg: message to write.
  • $level: one of the log level constants listed above.
  • Returns the number of bytes written, or null when the message is skipped.

close_log_file()

Closes the active log file handle. In normal use this is also registered automatically on shutdown after the first write.

FAQs

Package last updated on 06 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts