Skip to content

ytake/hack-logging

Repository files navigation

hack-logging

Build Status

Requirements

HHVM 4.35.0 and above.

Usage

$ composer require hack-logging/hack-logging

StdHandler

use type HackLogging\Logger;
use type HackLogging\LogLevel;
use type HackLogging\Handler\StdHandler;
use namespace HH\Lib\Experimental\IO;

list($read, $write) = IO\pipe_non_disposable();
$log = new Logger('hack-logging', vec[
  new StdHandler($write)
]);
\HH\Asio\join(
  $log->writeAsync(LogLevel::DEBUG, 'hacklogging-test')
);

FilesystemHandler

use type HackLogging\Logger;
use type HackLogging\LogLevel;
use type HackLogging\Handler\FilesystemHandler;
use namespace HH\Lib\Experimental\Filesystem;

$filename = sys_get_temp_dir().'/'.bin2hex(random_bytes(16));
$file = Filesystem\open_write_only_non_disposable($filename);
$log = new Logger('hack-logging', vec[
  new FilesystemHandler($file)
]);
\HH\Asio\join(
  $log->writeAsync(LogLevel::DEBUG, 'hacklogging-test', dict['context' => vec['nice']])
);

About

Send logs to files For HHVM/Hack

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors